<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel=stylesheet href="../../code.css" type="text/css"></head><body><pre><span class='linenumber'>   1</span> <span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>   2</span> </span><span class="COMM">/**
<span class='linenumber'>   3</span>  * jProton JavaScript Framework, version 0.3.0a
<span class='linenumber'>   4</span>  * Copyright (c) 2008 Pedro Simonetti Garcia
<span class='linenumber'>   5</span>  * 
<span class='linenumber'>   6</span>  * Version - 0.3.0a
<span class='linenumber'>   7</span>  * $Revision: 238 $
<span class='linenumber'>   8</span>  * $Date: 2008-03-25 07:57:54 -0300 (ter, 25 mar 2008) $
<span class='linenumber'>   9</span>  * 
<span class='linenumber'>  10</span>  * Project site: http://code.google.com/p/jproton/
<span class='linenumber'>  11</span>  * Licensed under MIT: http://www.opensource.org/licenses/mit-license.php
<span class='linenumber'>  12</span>  */</span><span class="WHIT">
<span class='linenumber'>  13</span> 
<span class='linenumber'>  14</span> </span><span class="COMM">/**
<span class='linenumber'>  15</span>  * Namespace central do framework. "jProton" é um namespace executável, de modo
<span class='linenumber'>  16</span>  * que ele é tanto um agregador de métodos/atributos quanto uma função. Como
<span class='linenumber'>  17</span>  * namespace, ele é o agregador de todas funcionalidades do framework. Como
<span class='linenumber'>  18</span>  * função, ele é um atalho para o principal recurso do framework: a seleção de
<span class='linenumber'>  19</span>  * elementos do "documento". Além disso, o namespace "$" é um atalho para 
<span class='linenumber'>  20</span>  * "jProton", de modo que os dois códigos abaixo:
<span class='linenumber'>  21</span>  * 
<span class='linenumber'>  22</span>  * ~~
<span class='linenumber'>  23</span>  * // Usa o namespace jProton para instanciar a classe jProton.Set
<span class='linenumber'>  24</span>  * jProton(selector, context)
<span class='linenumber'>  25</span>  * // Usa o atalho $ para instanciar a classe jProton.Set
<span class='linenumber'>  26</span>  * $(selector, context)
<span class='linenumber'>  27</span>  * ~~
<span class='linenumber'>  28</span>  * 
<span class='linenumber'>  29</span>  * equivalem a:
<span class='linenumber'>  30</span>  * 
<span class='linenumber'>  31</span>  * ~~
<span class='linenumber'>  32</span>  * // Instancia uma nova classe jProton.Set explicitamente 
<span class='linenumber'>  33</span>  * new jProton.Set().select(selector, context)
<span class='linenumber'>  34</span>  * ~~
<span class='linenumber'>  35</span>  * 
<span class='linenumber'>  36</span>  * A maioria dos recursos do framework encontram-se dentro de outros namespaces
<span class='linenumber'>  37</span>  * dentro de "jProton", como "jProton.Set", ou "jProton.ajax". Mas, alguns 
<span class='linenumber'>  38</span>  * recursos especiais encontram-se no próprio namespace "jProton", como os 
<span class='linenumber'>  39</span>  * métodos "jProton.trim"() e "jProton.each"(), acessíveis também como 
<span class='linenumber'>  40</span>  * "$.trim()" e "$.each()".
<span class='linenumber'>  41</span>  *  
<span class='linenumber'>  42</span>  * @name jProton
<span class='linenumber'>  43</span>  * @namespace
<span class='linenumber'>  44</span>  * @extends core
<span class='linenumber'>  45</span>  */</span><span class="COMM">/** @ignore */</span><span class="WHIT">
<span class='linenumber'>  46</span> </span><span class="NAME">window.jProton</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>  47</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jProton.Set</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">select</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  48</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  49</span> 
<span class='linenumber'>  50</span> </span><span class="COMM">/** 
<span class='linenumber'>  51</span>  * Atalho para o namespace "jProton". Considerando que "jProton" é um 
<span class='linenumber'>  52</span>  * namespace executável, ou seja, ele é um namespace e função ao mesmo tempo,
<span class='linenumber'>  53</span>  * o atalho "$" pode ser usado para ambos os casos. Ou seja, é possível usá-lo 
<span class='linenumber'>  54</span>  * como namespace para acessar recursos do framework, como a método "$.trim()", 
<span class='linenumber'>  55</span>  * o namespace "$.ajax", ou a classe "$.Set". É possível também usá-lo como 
<span class='linenumber'>  56</span>  * função, no formato "$()", o que consiste no atalho para instanciar uma 
<span class='linenumber'>  57</span>  * classe "jProton.Set".
<span class='linenumber'>  58</span>  * 
<span class='linenumber'>  59</span>  * @function
<span class='linenumber'>  60</span>  * @name $
<span class='linenumber'>  61</span>  * @param {String}  selector  Seletor usado para selecionar os elementos.
<span class='linenumber'>  62</span>  * @param {Element} [context] Contexto usado na busca. O padrão é "document".
<span class='linenumber'>  63</span>  * @return {jProton.Set}
<span class='linenumber'>  64</span>  * @see jProton
<span class='linenumber'>  65</span>  * @extends core 
<span class='linenumber'>  66</span>  */</span><span class="WHIT">
<span class='linenumber'>  67</span> </span><span class="NAME">window.$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  68</span> 
<span class='linenumber'>  69</span> 
<span class='linenumber'>  70</span> </span><span class="COMM">/**
<span class='linenumber'>  71</span>  * Cria um namespace, e retorna o último objeto desse namespace.
<span class='linenumber'>  72</span>  * 
<span class='linenumber'>  73</span>  * *Exemplo:*
<span class='linenumber'>  74</span>  * ~~
<span class='linenumber'>  75</span>  * // Cria o namespace 'my.name.space' caso não exista, e retorna o último 
<span class='linenumber'>  76</span>  * // objeto do namespace, no caso o objeto 'space'.
<span class='linenumber'>  77</span>  * $.namespace('my.name.space');
<span class='linenumber'>  78</span>  * ~~
<span class='linenumber'>  79</span>  * 
<span class='linenumber'>  80</span>  * @function
<span class='linenumber'>  81</span>  * @param {Object}  ns   Namespace a ser criado.
<span class='linenumber'>  82</span>  */</span><span class="WHIT">
<span class='linenumber'>  83</span> </span><span class="NAME">jProton.namespace</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">ns</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>  84</span>   </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">ns</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>  85</span>     </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  86</span> 
<span class='linenumber'>  87</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ns.split</span><span class="PUNC">(</span><span class="STRN">'.'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  88</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">window</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  89</span>   
<span class='linenumber'>  90</span>   </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ni</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ni</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>  91</span>     </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">ni</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">ni</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  92</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>  93</span> 
<span class='linenumber'>  94</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  95</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>  96</span> 
<span class='linenumber'>  97</span> 
<span class='linenumber'>  98</span> </span><span class="COMM">/**
<span class='linenumber'>  99</span>  * Extende as propriedades de um ou mais objetos-fonte para outro objeto-alvo. 
<span class='linenumber'> 100</span>  * Se apenas um objeto for passado como parâmetro, ele será considerado o
<span class='linenumber'> 101</span>  * objeto-fonte, e o objeto referenciado por "this" será considerado o alvo,
<span class='linenumber'> 102</span>  * que nesse caso será o namespace "jProton". Se mais de um objeto for
<span class='linenumber'> 103</span>  * passado como parâmetro, o primeiro objeto será considerado o alvo, e os 
<span class='linenumber'> 104</span>  * objetos restantes serão considerados as fontes.
<span class='linenumber'> 105</span>  * 
<span class='linenumber'> 106</span>  * Ao final, será retornado o objeto-alvo extendido.
<span class='linenumber'> 107</span>  * 
<span class='linenumber'> 108</span>  * ===Sintaxe:===
<span class='linenumber'> 109</span>  * ~~
<span class='linenumber'> 110</span>  * jProton.extend( source || ( target, source1 [ , source2, ... ] ) );
<span class='linenumber'> 111</span>  * ~~
<span class='linenumber'> 112</span>  * 
<span class='linenumber'> 113</span>  * Existem três propriedades que possuem significado especial quando 
<span class='linenumber'> 114</span>  * definidas no objeto fonte. Elas são: "@init", "@extension" e "@require".
<span class='linenumber'> 115</span>  * Essas propriedades não serão extendidas para o objeto alvo, servindo apenas
<span class='linenumber'> 116</span>  * para definir respectivamente a inicialização, registro e dependência da 
<span class='linenumber'> 117</span>  * extensão.
<span class='linenumber'> 118</span>  * 
<span class='linenumber'> 119</span>  * *NOTA: A maneira de declarar as extensões e suas dependências será 
<span class='linenumber'> 120</span>  * diferente na versão 0.4.x, e por consequência, as propriedades
<span class='linenumber'> 121</span>  * "@extension" e "@require" entrarão em desuso.*
<span class='linenumber'> 122</span>  * 
<span class='linenumber'> 123</span>  * ==Inicialização de Extensões==
<span class='linenumber'> 124</span>  * 
<span class='linenumber'> 125</span>  * Algumas extensões necessitam que um determinado código seja executado 
<span class='linenumber'> 126</span>  * assim que a extensão for criada. Para isso, deve-se informar no objeto
<span class='linenumber'> 127</span>  * fonte a ser inicializado a propriedade especial "@init", com a devida
<span class='linenumber'> 128</span>  * função de inicialização como seu valor.
<span class='linenumber'> 129</span>  * 
<span class='linenumber'> 130</span>  * ==Registro de Extensões==
<span class='linenumber'> 131</span>  * 
<span class='linenumber'> 132</span>  * Além disso, o método "jProton.extend()" pode ser usado também para registrar 
<span class='linenumber'> 133</span>  * extensões automaticamente. Para isso, deve-se informar uma propriedade 
<span class='linenumber'> 134</span>  * especial no objeto fonte com nome "@extension". O valor dessa propriedade é 
<span class='linenumber'> 135</span>  * um objeto que especifica o nome e versão da extensão, no seguinte formato:
<span class='linenumber'> 136</span>  * 
<span class='linenumber'> 137</span>  * ~~
<span class='linenumber'> 138</span>  *   '@extension': {'name': 'version'}
<span class='linenumber'> 139</span>  * ~~
<span class='linenumber'> 140</span>  * 
<span class='linenumber'> 141</span>  * O registro é feito definindo uma propriedade com nome "name" e valor 
<span class='linenumber'> 142</span>  * "version" no namespace "extensions" do objeto alvo. Repare que se um
<span class='linenumber'> 143</span>  * namespace for informado como alvo, a extensão será registrada no último
<span class='linenumber'> 144</span>  * objeto do namespace, como exemplificado abaixo:
<span class='linenumber'> 145</span>  * 
<span class='linenumber'> 146</span>  * ~~
<span class='linenumber'> 147</span>  *   target.namespace.extensions.name = 'version';
<span class='linenumber'> 148</span>  * ~~
<span class='linenumber'> 149</span>  * 
<span class='linenumber'> 150</span>  * 
<span class='linenumber'> 151</span>  * ==Dependência de Extensões==
<span class='linenumber'> 152</span>  * 
<span class='linenumber'> 153</span>  * Se a extensão que está sendo criada usa recursos de uma outra extensão,
<span class='linenumber'> 154</span>  * deve-se usar a propriedade especial "@require" para a dependência com
<span class='linenumber'> 155</span>  * outra extensão, evitando assim que a extensão seja carregada caso a
<span class='linenumber'> 156</span>  * extensão requirida não esteja instalada.
<span class='linenumber'> 157</span>  * 
<span class='linenumber'> 158</span>  * Se a extensão requerida não estiver instalada, será gerado um erro 
<span class='linenumber'> 159</span>  * indicando que a extensão deve ser instalada. Se a extensão requerida 
<span class='linenumber'> 160</span>  * estiver instalada, mas for de uma versão inferior a versão requerida, 
<span class='linenumber'> 161</span>  * será gerado um erro indicando a versão instalada é inferior a versão
<span class='linenumber'> 162</span>  * requerida.
<span class='linenumber'> 163</span>  * 
<span class='linenumber'> 164</span>  * O exemplo a seguir ilustra o uso das três propriedades especiais para
<span class='linenumber'> 165</span>  * se criar uma extensão de "jProton". Será criada a extensão "myExt" versão
<span class='linenumber'> 166</span>  * "0.1" no namespace "jProton.myPlugin" apenas se a extensão "myOtherExt" 
<span class='linenumber'> 167</span>  * versão "0.2" já estiver instalada em "jProton.myPlugin". Se a extensão
<span class='linenumber'> 168</span>  * requerida estiver instalada, será criado o namespace "jProton.myPlugin", 
<span class='linenumber'> 169</span>  * e adicionado a ele a propriedade "newProperty" e o método "newMethod". Além 
<span class='linenumber'> 170</span>  * disso, como esta sendo informado a propriedade "@extension", será criada 
<span class='linenumber'> 171</span>  * uma nova propriedade "jProton.myPlugin.extensions.myExt" com o valor "0.1". 
<span class='linenumber'> 172</span>  * Ao final, será retornado o objeto alvo raiz, no caso, o objeto "jProton".
<span class='linenumber'> 173</span>  * 
<span class='linenumber'> 174</span>  * *Exemplo 2:*
<span class='linenumber'> 175</span>  * ~~
<span class='linenumber'> 176</span>  * // Cria o namespace onde do plugin
<span class='linenumber'> 177</span>  * $.namespace('jProton.myPlugin');
<span class='linenumber'> 178</span>  * 
<span class='linenumber'> 179</span>  * // Cria uma nova extensão no namespace 'jProton.myPlugin'. Será criada
<span class='linenumber'> 180</span>  * // uma nova propriedade 'jProton.myPlugin.extensions.myExt' com o valor
<span class='linenumber'> 181</span>  * // '0.1' indicando o registro e versão da extensão.
<span class='linenumber'> 182</span>  * $.extend(jProton.myPlugin, {
<span class='linenumber'> 183</span>  * 
<span class='linenumber'> 184</span>  *   // declara a dependência com outra extensão
<span class='linenumber'> 185</span>  *   '@require': {'myOtherExt': '0.2'},
<span class='linenumber'> 186</span>  *   
<span class='linenumber'> 187</span>  *   // registra a extensão  
<span class='linenumber'> 188</span>  *   '@extension': {'myExt': '0.1'},
<span class='linenumber'> 189</span>  *   
<span class='linenumber'> 190</span>  *   // Função de inicialização
<span class='linenumber'> 191</span>  *   '@init': function() {
<span class='linenumber'> 192</span>  *     // O código de inicialização segue aqui
<span class='linenumber'> 193</span>  *     ...
<span class='linenumber'> 194</span>  *   },
<span class='linenumber'> 195</span>  *    
<span class='linenumber'> 196</span>  *   // nova propriedade a ser extendida
<span class='linenumber'> 197</span>  *   newProperty: 'value',
<span class='linenumber'> 198</span>  *    
<span class='linenumber'> 199</span>  *   // novo método a ser extendido
<span class='linenumber'> 200</span>  *   newMethod: function() {
<span class='linenumber'> 201</span>  *     return this.newProperty;
<span class='linenumber'> 202</span>  *   }
<span class='linenumber'> 203</span>  *   
<span class='linenumber'> 204</span>  * });
<span class='linenumber'> 205</span>  * ~~
<span class='linenumber'> 206</span>  * 
<span class='linenumber'> 207</span>  * @function
<span class='linenumber'> 208</span>  * @param {Object} [target]  Objeto alvo para onde as propriedades serão
<span class='linenumber'> 209</span>  *                           copiadas.
<span class='linenumber'> 210</span>  * @param {Object}  source   Objeto fonte de onde as propriedades serão
<span class='linenumber'> 211</span>  *                           copiadas.
<span class='linenumber'> 212</span>  * @return {Object} Retorna o objeto "target" extendido.
<span class='linenumber'> 213</span>  * @extends core
<span class='linenumber'> 214</span>  * @see jProton.namespace
<span class='linenumber'> 215</span>  */</span><span class="WHIT">
<span class='linenumber'> 216</span> </span><span class="NAME">jProton.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 217</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 218</span>       </span><span class="NAME">a0</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">al</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 219</span> 
<span class='linenumber'> 220</span>   </span><span class="COMM">// processa o target</span><span class="WHIT">
<span class='linenumber'> 221</span>   </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">al</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 222</span>     </span><span class="NAME">ai</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 223</span>     </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 224</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 225</span> 
<span class='linenumber'> 226</span>   </span><span class="COMM">// processa a extensão para cada objeto fonte</span><span class="WHIT">
<span class='linenumber'> 227</span>   </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NAME">ai</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 228</span> 
<span class='linenumber'> 229</span>     </span><span class="COMM">// para cada propriedade do objeto fonte</span><span class="WHIT">
<span class='linenumber'> 230</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 231</span>       </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 232</span>       
<span class='linenumber'> 233</span>       </span><span class="COMM">// herda as propriedades do objeto fonte</span><span class="WHIT">
<span class='linenumber'> 234</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop.charAt</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'@'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 235</span>         
<span class='linenumber'> 236</span>         </span><span class="COMM">// se a propriedade for um array, extende esse array. Ou seja, se</span><span class="WHIT">
<span class='linenumber'> 237</span>         </span><span class="COMM">// já existir algum array na propriedade do objeto destino, concatena </span><span class="WHIT">
<span class='linenumber'> 238</span>         </span><span class="COMM">// com o outro array. Se não existir, copia o array.</span><span class="WHIT">
<span class='linenumber'> 239</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">p.splice</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 240</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tp</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 241</span>           </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tp</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">tp.splice</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">tp.concat</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">concat</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 242</span> 
<span class='linenumber'> 243</span>         </span><span class="COMM">// se a propriedade for um objeto, extende esse objeto. Ou seja, se</span><span class="WHIT">
<span class='linenumber'> 244</span>         </span><span class="COMM">// já existir algum objeto na propriedade do objeto destino, extende o</span><span class="WHIT">
<span class='linenumber'> 245</span>         </span><span class="COMM">// objeto. Se não existir, cria uma cópia do objeto.</span><span class="WHIT">
<span class='linenumber'> 246</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 247</span>           </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 248</span> 
<span class='linenumber'> 249</span>         </span><span class="COMM">// se for uma propriedade comum, copia seu valor</span><span class="WHIT">
<span class='linenumber'> 250</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 251</span>           </span><span class="NAME">t</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 252</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 253</span>         
<span class='linenumber'> 254</span>       </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 255</span>         </span><span class="COMM">// processa a dependência de módulos</span><span class="WHIT">
<span class='linenumber'> 256</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'@init'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 257</span>           </span><span class="NAME">p.call</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 258</span>           
<span class='linenumber'> 259</span>         </span><span class="COMM">// processa a dependência de módulos</span><span class="WHIT">
<span class='linenumber'> 260</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'@require'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 261</span>           </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ext</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 262</span> 
<span class='linenumber'> 263</span>             </span><span class="COMM">// versão requerida</span><span class="WHIT">
<span class='linenumber'> 264</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">[</span><span class="NAME">ext</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 265</span>             
<span class='linenumber'> 266</span>             </span><span class="COMM">// verifica se extensão requerida está instalada</span><span class="WHIT">
<span class='linenumber'> 267</span>             </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">t.extensions</span><span class="PUNC">[</span><span class="NAME">ext</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 268</span> 
<span class='linenumber'> 269</span>             </span><span class="COMM">// confirma a existência e versão da extensão</span><span class="WHIT">
<span class='linenumber'> 270</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">o</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 271</span>               </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">'A extensão "'</span><span class="PUNC">+</span><span class="NAME">ext</span><span class="PUNC">+</span><span class="STRN">'" deve estar instalada.'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 272</span> 
<span class='linenumber'> 273</span>             </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">v</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'all'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 274</span>               </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">'A extensão "'</span><span class="PUNC">+</span><span class="NAME">ext</span><span class="PUNC">+</span><span class="STRN">'" deve ter a versão '</span><span class="PUNC">+</span><span class="NAME">v</span><span class="PUNC">+</span><span class="STRN">' ou superior.'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 275</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 276</span> 
<span class='linenumber'> 277</span>         </span><span class="COMM">// processa o registro da extensão</span><span class="WHIT">
<span class='linenumber'> 278</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'@extension'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 279</span> 
<span class='linenumber'> 280</span>           </span><span class="COMM">// registra a extensão no namespace "extensions" do objeto</span><span class="WHIT">
<span class='linenumber'> 281</span>           </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">t.extensions</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">t.extensions</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 282</span>           </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 283</span>             </span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 284</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 285</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 286</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 287</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 288</span>   </span><span class="COMM">// retorna o objeto alvo extendido</span><span class="WHIT">
<span class='linenumber'> 289</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 290</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 291</span> 
<span class='linenumber'> 292</span> 
<span class='linenumber'> 293</span> </span><span class="COMM">// Extensão central de jProton.</span><span class="WHIT">
<span class='linenumber'> 294</span> </span><span class="COMM">/**#@+ @extends core */</span><span class="WHIT">
<span class='linenumber'> 295</span> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="COMM">/** @lends jProton */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 296</span> 
<span class='linenumber'> 297</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'core'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 298</span> 
<span class='linenumber'> 299</span>   </span><span class="COMM">/**
<span class='linenumber'> 300</span>    * Atalho para a função "document.getElementById()".
<span class='linenumber'> 301</span>    *  
<span class='linenumber'> 302</span>    * @param {String} id
<span class='linenumber'> 303</span>    * @return {Element}
<span class='linenumber'> 304</span>    */</span><span class="WHIT">
<span class='linenumber'> 305</span>   </span><span class="NAME">id</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 306</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 307</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 308</span> 
<span class='linenumber'> 309</span>   </span><span class="COMM">/**
<span class='linenumber'> 310</span>    * Executa uma função para cada elemento de um array.
<span class='linenumber'> 311</span>    * 
<span class='linenumber'> 312</span>    * ~~
<span class='linenumber'> 313</span>    * // Exibe os elementos de um array
<span class='linenumber'> 314</span>    * $.each(array, function(i,e) {
<span class='linenumber'> 315</span>    *   alert('O elemento de número ' + i + ' é igual a ' + e);
<span class='linenumber'> 316</span>    * });
<span class='linenumber'> 317</span>    * ~~
<span class='linenumber'> 318</span>    * 
<span class='linenumber'> 319</span>    * @param {Array}    a   Array a ser percorrido.
<span class='linenumber'> 320</span>    * @param {Function} fn  Função a ser chamada para cada elemento.
<span class='linenumber'> 321</span>    */</span><span class="WHIT">
<span class='linenumber'> 322</span>   </span><span class="NAME">each</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 323</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="PUNC">=</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 324</span>       </span><span class="NAME">fn.call</span><span class="PUNC">(</span><span class="NAME">ai</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 325</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 326</span> 
<span class='linenumber'> 327</span>   </span><span class="COMM">/**
<span class='linenumber'> 328</span>    * Remove os espaços laterais de uma string.
<span class='linenumber'> 329</span>    * 
<span class='linenumber'> 330</span>    * @param {String}  s  String a ser alterada.
<span class='linenumber'> 331</span>    * @return {String}
<span class='linenumber'> 332</span>    */</span><span class="WHIT">
<span class='linenumber'> 333</span>   </span><span class="NAME">trim</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 334</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="REGX">/^\s*|\s*$/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 335</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 336</span> 
<span class='linenumber'> 337</span>   </span><span class="COMM">/** 
<span class='linenumber'> 338</span>    * Função vazia usada para remover funções adicionadas a elementos.
<span class='linenumber'> 339</span>    */</span><span class="WHIT">
<span class='linenumber'> 340</span>   </span><span class="NAME">emptyFn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 341</span> 
<span class='linenumber'> 342</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'> 343</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 344</span> 
<span class='linenumber'> 345</span> 
<span class='linenumber'> 346</span> </span><span class="COMM">/**
<span class='linenumber'> 347</span>  * Principal classe do framework, que permite a seleção e manipulação 
<span class='linenumber'> 348</span>  * simultânea de conjuntos de elementos. Na prática, você raramente irá 
<span class='linenumber'> 349</span>  * instanciar manualmente uma classe "jProton.Set". Ao invés disso, é 
<span class='linenumber'> 350</span>  * mais conveniente usar a função "jProton()", ou o atalho "$()", pois os dois 
<span class='linenumber'> 351</span>  * códigos abaixo:
<span class='linenumber'> 352</span>  * 
<span class='linenumber'> 353</span>  * ~~
<span class='linenumber'> 354</span>  * // Usa o namespace jProton para instanciar a classe jProton.Set
<span class='linenumber'> 355</span>  * jProton(selector, context)
<span class='linenumber'> 356</span>  * // Usa o namespace alternativo $ para instanciar a classe jProton.Set
<span class='linenumber'> 357</span>  * $(selector, context)
<span class='linenumber'> 358</span>  * ~~
<span class='linenumber'> 359</span>  * 
<span class='linenumber'> 360</span>  * equivalem a:
<span class='linenumber'> 361</span>  *    
<span class='linenumber'> 362</span>  * ~~
<span class='linenumber'> 363</span>  * // Instancia explicitamente um novo objeto da classe jProton.Set 
<span class='linenumber'> 364</span>  * new jProton.Set().select(selector, context)
<span class='linenumber'> 365</span>  * ~~
<span class='linenumber'> 366</span>  * @extends core
<span class='linenumber'> 367</span>  * @class Principal classe do framework, que permite a seleção e manipulação 
<span class='linenumber'> 368</span>  * simultânea de conjuntos de elementos.
<span class='linenumber'> 369</span>  */</span><span class="WHIT">
<span class='linenumber'> 370</span> </span><span class="NAME">jProton.Set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 371</span> 
<span class='linenumber'> 372</span> </span><span class="COMM">// A classe jProton.Set é uma sublcasse de Array</span><span class="WHIT">
<span class='linenumber'> 373</span> </span><span class="NAME">jProton.Set.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 374</span> 
<span class='linenumber'> 375</span> </span><span class="COMM">/**
<span class='linenumber'> 376</span>  * Atalho para incluir funcionalidades na classe jProton.Set.
<span class='linenumber'> 377</span>  * 
<span class='linenumber'> 378</span>  * @type {jProton.Set}
<span class='linenumber'> 379</span>  * @extends core
<span class='linenumber'> 380</span>  */</span><span class="WHIT">
<span class='linenumber'> 381</span> </span><span class="NAME">jProton.set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.Set.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 382</span> 
<span class='linenumber'> 383</span> </span><span class="COMM">// Atalho para jProton.set</span><span class="WHIT">
<span class='linenumber'> 384</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.set</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 385</span> 
<span class='linenumber'> 386</span> </span><span class="COMM">// Adiciona a função extend para a classe jProton.Set</span><span class="WHIT">
<span class='linenumber'> 387</span> </span><span class="NAME">set.extend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.extend</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 388</span> 
<span class='linenumber'> 389</span> 
<span class='linenumber'> 390</span> </span><span class="COMM">// Extensão central da classe jProton.Set.</span><span class="WHIT">
<span class='linenumber'> 391</span> </span><span class="COMM">/**#@+ @extends core */</span><span class="WHIT">
<span class='linenumber'> 392</span> </span><span class="NAME">set.extend</span><span class="PUNC">(</span><span class="COMM">/** @lends jProton.Set.prototype */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 393</span> 
<span class='linenumber'> 394</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'core'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 395</span> 
<span class='linenumber'> 396</span>   </span><span class="COMM">/** 
<span class='linenumber'> 397</span>    * Referência para o último conjunto da cadeia de operações.
<span class='linenumber'> 398</span>    * 
<span class='linenumber'> 399</span>    * @type jProton.Set
<span class='linenumber'> 400</span>    */</span><span class="WHIT">
<span class='linenumber'> 401</span>   </span><span class="NAME">_lastSet</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 402</span> 
<span class='linenumber'> 403</span>   </span><span class="COMM">/** 
<span class='linenumber'> 404</span>    * Versão do framework.
<span class='linenumber'> 405</span>    * 
<span class='linenumber'> 406</span>    * @type String
<span class='linenumber'> 407</span>    */</span><span class="WHIT">
<span class='linenumber'> 408</span>   </span><span class="NAME">jproton</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'jProton.0.3.9a'</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 409</span> 
<span class='linenumber'> 410</span>   </span><span class="COMM">/**
<span class='linenumber'> 411</span>    * Método privado usado para ligar diferentes operações em cadeia. Será 
<span class='linenumber'> 412</span>    * instanciado um novo objeto da classe "jProton.Set", vazio, ligado ao 
<span class='linenumber'> 413</span>    * objeto atual pela referência do parâmetro "jProton.Set._lastSet". Caso 
<span class='linenumber'> 414</span>    * seja informado algum array de elementos, o novo objeto será preenchido 
<span class='linenumber'> 415</span>    * com esse conjunto de elementos.
<span class='linenumber'> 416</span>    * 
<span class='linenumber'> 417</span>    * @param {Array} [e] Array de elementos
<span class='linenumber'> 418</span>    * @return {jProton.Set}
<span class='linenumber'> 419</span>    */</span><span class="WHIT">
<span class='linenumber'> 420</span>   </span><span class="NAME">_chain</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 421</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jProton</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">copy</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 422</span> 
<span class='linenumber'> 423</span>     </span><span class="NAME">r._lastSet</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 424</span> 
<span class='linenumber'> 425</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 426</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 427</span> 
<span class='linenumber'> 428</span>   </span><span class="COMM">/**
<span class='linenumber'> 429</span>    * Adiciona os elementos que correspondem ao seletor informado. O parâmetro
<span class='linenumber'> 430</span>    * seletor indica quais elementos serão selecionados, enquanto que o 
<span class='linenumber'> 431</span>    * parâmetro contexto indica nos descendentes de qual elemento será será
<span class='linenumber'> 432</span>    * feita a busca. Se nenhum contexto for informado, ele será considerado o
<span class='linenumber'> 433</span>    * "document", ou seja, a busca ocorrerá em todo o documento. Opcionalmente,
<span class='linenumber'> 434</span>    * pode-se passar um seletor como contexto, e nesse caso, o primeiro elemento
<span class='linenumber'> 435</span>    * selecionado será usado como contexto.
<span class='linenumber'> 436</span>    * 
<span class='linenumber'> 437</span>    * @param {String}  selector  Seletor que descreve os elementos a serem 
<span class='linenumber'> 438</span>    *                            escolhidos.
<span class='linenumber'> 439</span>    * @param {Element} [context] Contexto usado na busca. O padrão é "document".
<span class='linenumber'> 440</span>    * @return {jProton.Set}
<span class='linenumber'> 441</span>    */</span><span class="WHIT">
<span class='linenumber'> 442</span>   </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 443</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 444</span> 
<span class='linenumber'> 445</span>     </span><span class="COMM">// processa $(expr)</span><span class="WHIT">
<span class='linenumber'> 446</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 447</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.copy</span><span class="PUNC">(</span><span class="NAME">query.select</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 448</span> 
<span class='linenumber'> 449</span>     </span><span class="COMM">// processa $(obj)</span><span class="WHIT">
<span class='linenumber'> 450</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 451</span> 
<span class='linenumber'> 452</span>       </span><span class="COMM">// processa $(element)</span><span class="WHIT">
<span class='linenumber'> 453</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">selector.nodeName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 454</span>         </span><span class="NAME">this.push</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 455</span> 
<span class='linenumber'> 456</span>       </span><span class="COMM">// processa $(array-like)</span><span class="WHIT">
<span class='linenumber'> 457</span>       </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">selector.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 458</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.copy</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 459</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 460</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 461</span> 
<span class='linenumber'> 462</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'> 463</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 464</span>   
<span class='linenumber'> 465</span>   </span><span class="COMM">/**
<span class='linenumber'> 466</span>    * Adiciona novos elementos ao conjunto.
<span class='linenumber'> 467</span>    * 
<span class='linenumber'> 468</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 469</span>    *                             adicionados.
<span class='linenumber'> 470</span>    * @param {Element} [context]  Contexto usado na busca. O padrão é "document".
<span class='linenumber'> 471</span>    * @return {jProton.Set}
<span class='linenumber'> 472</span>    */</span><span class="WHIT">
<span class='linenumber'> 473</span>   </span><span class="NAME">add</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 474</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._chain</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">select</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 475</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 476</span> 
<span class='linenumber'> 477</span>   </span><span class="COMM">/**
<span class='linenumber'> 478</span>    * Procura por elementos dentro dos elementos selecionados. O conjunto atual
<span class='linenumber'> 479</span>    * de elementos selecionados será usado como contexto de uma nova busca.
<span class='linenumber'> 480</span>    * 
<span class='linenumber'> 481</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 482</span>    *                             pesquisados.
<span class='linenumber'> 483</span>    * @return {jProton.Set}
<span class='linenumber'> 484</span>    */</span><span class="WHIT">
<span class='linenumber'> 485</span>   </span><span class="NAME">find</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 486</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._chain</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">select</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 487</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 488</span> 
<span class='linenumber'> 489</span>   </span><span class="COMM">/**
<span class='linenumber'> 490</span>    * Filtra os elementos selecionados deixando apenas os que satisfaçam ao 
<span class='linenumber'> 491</span>    * seletor.
<span class='linenumber'> 492</span>    * 
<span class='linenumber'> 493</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 494</span>    *                             filtrados.
<span class='linenumber'> 495</span>    * @return {jProton.Set}
<span class='linenumber'> 496</span>    */</span><span class="WHIT">
<span class='linenumber'> 497</span>   </span><span class="NAME">filter</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 498</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._chain</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">copy</span><span class="PUNC">(</span><span class="NAME">query.filter</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 499</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 500</span>   
<span class='linenumber'> 501</span>   </span><span class="COMM">/**
<span class='linenumber'> 502</span>    * Filtra os elementos selecionados removendo aqueles que satisfaçam ao 
<span class='linenumber'> 503</span>    * seletor.
<span class='linenumber'> 504</span>    * 
<span class='linenumber'> 505</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 506</span>    *                             filtrados.
<span class='linenumber'> 507</span>    * @return {jProton.Set}
<span class='linenumber'> 508</span>    */</span><span class="WHIT">
<span class='linenumber'> 509</span>   </span><span class="NAME">not</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 510</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._chain</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">copy</span><span class="PUNC">(</span><span class="NAME">query.filter</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 511</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 512</span>   
<span class='linenumber'> 513</span>   </span><span class="COMM">/**
<span class='linenumber'> 514</span>    * Procura pelo próximo irmão de cada elemento selecionado que satisfaça ao 
<span class='linenumber'> 515</span>    * seletor.
<span class='linenumber'> 516</span>    * 
<span class='linenumber'> 517</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 518</span>    *                             encontrados.
<span class='linenumber'> 519</span>    */</span><span class="WHIT">
<span class='linenumber'> 520</span>   </span><span class="NAME">next</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 521</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">=</span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 522</span>       </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">nextSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 523</span> 
<span class='linenumber'> 524</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">this.filter</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 525</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 526</span> 
<span class='linenumber'> 527</span>   </span><span class="COMM">/**
<span class='linenumber'> 528</span>    * Procura pelo irmão anterior de cada elemento selecionado que satisfaça ao 
<span class='linenumber'> 529</span>    * seletor.
<span class='linenumber'> 530</span>    * 
<span class='linenumber'> 531</span>    * @param {String}  selector   Seletor que descreve os elementos a serem 
<span class='linenumber'> 532</span>    *                             encontrados.
<span class='linenumber'> 533</span>    */</span><span class="WHIT">
<span class='linenumber'> 534</span>   </span><span class="NAME">prev</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 535</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">=</span><span class="NAME">this.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 536</span>       </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">previousSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 537</span> 
<span class='linenumber'> 538</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">this.filter</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 539</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 540</span> 
<span class='linenumber'> 541</span>   </span><span class="COMM">/**
<span class='linenumber'> 542</span>    * Encerra a operação atual e retorna o último objeto "jProton.Set" utilizado
<span class='linenumber'> 543</span>    * na cadeia.
<span class='linenumber'> 544</span>    * 
<span class='linenumber'> 545</span>    * @return {jProton.Set}
<span class='linenumber'> 546</span>    */</span><span class="WHIT">
<span class='linenumber'> 547</span>   </span><span class="NAME">end</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 548</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._lastSet</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">jProton.Set</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 549</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 550</span> 
<span class='linenumber'> 551</span>   </span><span class="COMM">/**
<span class='linenumber'> 552</span>    * Executa uma função para cada elemento selecionado.
<span class='linenumber'> 553</span>    * 
<span class='linenumber'> 554</span>    * ~~
<span class='linenumber'> 555</span>    * // Exibe o conteúdo de cada elemento H1 existente no documento.
<span class='linenumber'> 556</span>    * $('h1').each(function(i){
<span class='linenumber'> 557</span>    *   alert(this.innerHTML);
<span class='linenumber'> 558</span>    * });
<span class='linenumber'> 559</span>    * ~~
<span class='linenumber'> 560</span>    *    
<span class='linenumber'> 561</span>    * @param {Function} fn  Função a ser executada para cada elemento 
<span class='linenumber'> 562</span>    *                       selecionado. Essa função é chamada passando como
<span class='linenumber'> 563</span>    *                       parâmetro o índice do elemento. O elemento por sua
<span class='linenumber'> 564</span>    *                       vez é acessado pela palavra-chave "this".
<span class='linenumber'> 565</span>    * @return {jProton.Set}
<span class='linenumber'> 566</span>    */</span><span class="WHIT">
<span class='linenumber'> 567</span>   </span><span class="NAME">each</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">fn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 568</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 569</span>       </span><span class="NAME">fn.call</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 570</span> 
<span class='linenumber'> 571</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 572</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 573</span> 
<span class='linenumber'> 574</span>   </span><span class="COMM">/**
<span class='linenumber'> 575</span>    * Copia todos elementos de um array.
<span class='linenumber'> 576</span>    * 
<span class='linenumber'> 577</span>    * @param {Array}  a  Array a ser copiado.
<span class='linenumber'> 578</span>    * @return {jProton.Set}
<span class='linenumber'> 579</span>    */</span><span class="WHIT">
<span class='linenumber'> 580</span>   </span><span class="NAME">copy</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 581</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 582</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a.splice</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 583</span>         </span><span class="NAME">this.push.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 584</span> 
<span class='linenumber'> 585</span>       </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 586</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ai</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 587</span>           </span><span class="NAME">this.push</span><span class="PUNC">(</span><span class="NAME">ai</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 588</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 589</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 590</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 591</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 592</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 593</span> 
<span class='linenumber'> 594</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'> 595</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 596</span> 
<span class='linenumber'> 597</span> 
<span class='linenumber'> 598</span> </span><span class="COMM">/**
<span class='linenumber'> 599</span>  * Namespace responsável pela manipulação de elementos DOM.
<span class='linenumber'> 600</span>  * 
<span class='linenumber'> 601</span>  * @name jProton.element
<span class='linenumber'> 602</span>  * @namespace
<span class='linenumber'> 603</span>  */</span><span class="WHIT">
<span class='linenumber'> 604</span> </span><span class="NAME">jProton.namespace</span><span class="PUNC">(</span><span class="STRN">'jProton.element'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 605</span> 
<span class='linenumber'> 606</span> </span><span class="COMM">// Atalho para jProton.element</span><span class="WHIT">
<span class='linenumber'> 607</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">element</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.element</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 608</span> 
<span class='linenumber'> 609</span> 
<span class='linenumber'> 610</span> </span><span class="COMM">// Extensão dom para jProton.element.</span><span class="WHIT">
<span class='linenumber'> 611</span> </span><span class="COMM">/**#@+ @extends dom */</span><span class="WHIT">
<span class='linenumber'> 612</span> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">/** @lends jProton.element */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 613</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'dom'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 614</span>   
<span class='linenumber'> 615</span>   </span><span class="COMM">/**
<span class='linenumber'> 616</span>    * Retorna o valor da propriedade do elemento.
<span class='linenumber'> 617</span>    *      
<span class='linenumber'> 618</span>    * @name attr
<span class='linenumber'> 619</span>    * @param  {Element}  e     Elemento alvo.         
<span class='linenumber'> 620</span>    * @param  {String}   key   Nome da propiedade.
<span class='linenumber'> 621</span>    * @return {Value}
<span class='linenumber'> 622</span>    */</span><span class="WHIT">
<span class='linenumber'> 623</span>      
<span class='linenumber'> 624</span>   </span><span class="COMM">/**
<span class='linenumber'> 625</span>    * Altera o valor da proriedade do elemento.
<span class='linenumber'> 626</span>    * 
<span class='linenumber'> 627</span>    * @param  {Element}  e     Elemento alvo.         
<span class='linenumber'> 628</span>    * @param  {String}   key   Nome da propiedade.
<span class='linenumber'> 629</span>    * @param  {Value}    val   Valor a ser definido.
<span class='linenumber'> 630</span>    */</span><span class="WHIT">
<span class='linenumber'> 631</span>   </span><span class="NAME">attr</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 632</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 633</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 634</span>   
<span class='linenumber'> 635</span>   </span><span class="COMM">/**
<span class='linenumber'> 636</span>    * Retorna o valor da propriedade 'value' do elemento.
<span class='linenumber'> 637</span>    *    
<span class='linenumber'> 638</span>    * @name val
<span class='linenumber'> 639</span>    * @memberOf jProton.element;
<span class='linenumber'> 640</span>    * @param  {Element}  e     Elemento alvo.         
<span class='linenumber'> 641</span>    * @return {Value}
<span class='linenumber'> 642</span>    */</span><span class="WHIT">
<span class='linenumber'> 643</span>    
<span class='linenumber'> 644</span>   </span><span class="COMM">/**
<span class='linenumber'> 645</span>    * Altera valor da propriedade "value" do elemento. Se o elemento em questão 
<span class='linenumber'> 646</span>    * for do tipo "select options", a opção com o mesmo valor será selecionada.  
<span class='linenumber'> 647</span>    *    
<span class='linenumber'> 648</span>    * @name val
<span class='linenumber'> 649</span>    * @memberOf jProton.element;
<span class='linenumber'> 650</span>    * @param {Element} e    elemento alvo.         
<span class='linenumber'> 651</span>    * @param {String}  val  valor a ser atrubuído a propriedade "value".
<span class='linenumber'> 652</span>    */</span><span class="WHIT">
<span class='linenumber'> 653</span>            
<span class='linenumber'> 654</span>   </span><span class="COMM">/**
<span class='linenumber'> 655</span>    * Marca ou seleciona elementos do tipo "select options", "checkbox" ou 
<span class='linenumber'> 656</span>    * "radio button".
<span class='linenumber'> 657</span>    * 
<span class='linenumber'> 658</span>    * ~~
<span class='linenumber'> 659</span>    * // Seleciona as opções 'Multiple2' e 'Multiple3' do select de id 'multiple'   
<span class='linenumber'> 660</span>    * $('#multiple').val(['Multiple2', 'Multiple3']);
<span class='linenumber'> 661</span>    *    
<span class='linenumber'> 662</span>    * // Marca o checkbox de valor 'check2' e o radio button de valor 'radio1'
<span class='linenumber'> 663</span>    * $('input').val(['check2', 'radio1']);
<span class='linenumber'> 664</span>    * ~~
<span class='linenumber'> 665</span>    * 
<span class='linenumber'> 666</span>    * @param {Element} e        Elemento alvo.         
<span class='linenumber'> 667</span>    * @param {Array}   values   Array de Strings com os valores dos elementos
<span class='linenumber'> 668</span>    *                           que serão marcados ou selecionados.
<span class='linenumber'> 669</span>    *                        
<span class='linenumber'> 670</span>    * @return {jProton.query}
<span class='linenumber'> 671</span>    */</span><span class="WHIT">
<span class='linenumber'> 672</span>   </span><span class="NAME">val</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 673</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 674</span>       </span><span class="COMM">// processa $().val(val)</span><span class="WHIT">
<span class='linenumber'> 675</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 676</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">valType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 677</span>   
<span class='linenumber'> 678</span>         </span><span class="COMM">// processa $().val(String)</span><span class="WHIT">
<span class='linenumber'> 679</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">valType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 680</span>           </span><span class="NAME">e.value</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 681</span>   
<span class='linenumber'> 682</span>         </span><span class="COMM">// processa $().val(Array)</span><span class="WHIT">
<span class='linenumber'> 683</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">valType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 684</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val.length</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tag</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 685</span>   
<span class='linenumber'> 686</span>           </span><span class="COMM">// seleciona um ou mais elementos 'checkbox' ou 'radio'</span><span class="WHIT">
<span class='linenumber'> 687</span>           </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">tag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.nodeName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'input'</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> 
<span class='linenumber'> 688</span>               </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'checkbox'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'radio'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 689</span>             </span><span class="NAME">e.checked</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 690</span>             </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">vl</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 691</span>               </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.value</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 692</span>                 </span><span class="NAME">e.checked</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 693</span>   
<span class='linenumber'> 694</span>           </span><span class="COMM">// seleciona uma ou mais opções do elemento 'select'</span><span class="WHIT">
<span class='linenumber'> 695</span>           </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">tag</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'select'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 696</span>             </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">op</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">op</span><span class="PUNC">=</span><span class="NAME">e.options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ol</span><span class="PUNC">=</span><span class="NAME">o.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">&lt;</span><span class="NAME">ol</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 697</span>               </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.multiple</span><span class="PUNC">)</span><span class="WHIT"> 
<span class='linenumber'> 698</span>                 </span><span class="NAME">op</span><span class="PUNC">[</span><span class="NAME">o</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">selected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 699</span>   
<span class='linenumber'> 700</span>               </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">vl</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 701</span>                 </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">op</span><span class="PUNC">[</span><span class="NAME">o</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 702</span>                   </span><span class="NAME">op</span><span class="PUNC">[</span><span class="NAME">o</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">selected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 703</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 704</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 705</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 706</span>       </span><span class="COMM">// processa $().val()</span><span class="WHIT">
<span class='linenumber'> 707</span>       </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 708</span>         </span><span class="COMM">// se for um elemento comum, retorna seu valor</span><span class="WHIT">
<span class='linenumber'> 709</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e.nodeName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'select'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 710</span>           </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e.value</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 711</span>   
<span class='linenumber'> 712</span>         </span><span class="COMM">// se for um elemento 'select' retorna as opções selecionadas</span><span class="WHIT">
<span class='linenumber'> 713</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 714</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 715</span>           </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">=</span><span class="NAME">e.options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ol</span><span class="PUNC">=</span><span class="NAME">o.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">ol</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 716</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">selected</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 717</span>               </span><span class="NAME">r.push</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 718</span>   
<span class='linenumber'> 719</span>           </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e.multiple</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 720</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 721</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 722</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 723</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 724</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 725</span>   
<span class='linenumber'> 726</span>   </span><span class="COMM">/**
<span class='linenumber'> 727</span>    * Retorna o conteúdo de texto do elemento.
<span class='linenumber'> 728</span>    *    
<span class='linenumber'> 729</span>    * @name text
<span class='linenumber'> 730</span>    * @param  {Element} e   Elemento alvo.         
<span class='linenumber'> 731</span>    * @return {String}
<span class='linenumber'> 732</span>    */</span><span class="WHIT">
<span class='linenumber'> 733</span> 
<span class='linenumber'> 734</span>   </span><span class="COMM">/**
<span class='linenumber'> 735</span>    * Aletar o conteúdo de texto do elemento.
<span class='linenumber'> 736</span>    * 
<span class='linenumber'> 737</span>    * @name text
<span class='linenumber'> 738</span>    * @param {Element} e    Elemento alvo.         
<span class='linenumber'> 739</span>    * @param {String}  val  Conteúdo de texto a ser atribuído.
<span class='linenumber'> 740</span>    * @return {jProton.query}
<span class='linenumber'> 741</span>    */</span><span class="WHIT">
<span class='linenumber'> 742</span>   </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 743</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">txt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.textContent</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">
<span class='linenumber'> 744</span>         </span><span class="STRN">'textContent'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'innerText'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 745</span> 
<span class='linenumber'> 746</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">text</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 747</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">txt</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">txt</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 748</span>     </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 749</span> 
<span class='linenumber'> 750</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 751</span>   </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 752</span> 
<span class='linenumber'> 753</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'> 754</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 755</span> 
<span class='linenumber'> 756</span> 
<span class='linenumber'> 757</span> </span><span class="COMM">// Extensão dom para jProton.Set.</span><span class="WHIT">
<span class='linenumber'> 758</span> </span><span class="COMM">/**#@+ @extends dom */</span><span class="WHIT">
<span class='linenumber'> 759</span> </span><span class="NAME">set.extend</span><span class="PUNC">(</span><span class="COMM">/** @lends jProton.Set.prototype */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 760</span> 
<span class='linenumber'> 761</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'dom'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 762</span> 
<span class='linenumber'> 763</span>   </span><span class="COMM">/**
<span class='linenumber'> 764</span>    * Retorna o valor da propriedade do primeiro elemento selecionado. Se a 
<span class='linenumber'> 765</span>    * propriedade não existir, retorna undefined.   
<span class='linenumber'> 766</span>    * 
<span class='linenumber'> 767</span>    * @param  {String}   key   Nome da propiedade.
<span class='linenumber'> 768</span>    * @return {Value}
<span class='linenumber'> 769</span>    */</span><span class="WHIT">
<span class='linenumber'> 770</span> 
<span class='linenumber'> 771</span>   </span><span class="COMM">/**
<span class='linenumber'> 772</span>    * Altera o valor da proriedade de todos os elementos selecionados.
<span class='linenumber'> 773</span>    * 
<span class='linenumber'> 774</span>    * @param  {String}   key   Nome da propiedade.
<span class='linenumber'> 775</span>    * @param  {Value}    val   Valor a ser definido.
<span class='linenumber'> 776</span>    * @return {jProton.Set}
<span class='linenumber'> 777</span>    */</span><span class="WHIT">
<span class='linenumber'> 778</span>   </span><span class="NAME">attr</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 779</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 780</span>       </span><span class="COMM">// Processa $().attr(key, val)</span><span class="WHIT">
<span class='linenumber'> 781</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 782</span>         </span><span class="NAME">element.attr</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 783</span> 
<span class='linenumber'> 784</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 785</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 786</span>       </span><span class="COMM">// Processa $().attr(key)</span><span class="WHIT">
<span class='linenumber'> 787</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element.attr</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 788</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 789</span> 
<span class='linenumber'> 790</span>   </span><span class="COMM">/**
<span class='linenumber'> 791</span>    * Retorna o valor da propriedade 'value' do primeiro elemento selecionado.
<span class='linenumber'> 792</span>    * 
<span class='linenumber'> 793</span>    * @return {Value}
<span class='linenumber'> 794</span>    */</span><span class="WHIT">
<span class='linenumber'> 795</span> 
<span class='linenumber'> 796</span>   </span><span class="COMM">/**
<span class='linenumber'> 797</span>    * Altera valor à propriedade "value" de todos elementos selecionados. Se
<span class='linenumber'> 798</span>    * o elemento em questão for do tipo "select options", a opção com o mesmo
<span class='linenumber'> 799</span>    * valor será selecionada.  
<span class='linenumber'> 800</span>    * 
<span class='linenumber'> 801</span>    * ~~
<span class='linenumber'> 802</span>    * // Seleciona a opção que possui valor 'op1' de todos elementos 'select'   
<span class='linenumber'> 803</span>    * $('select').val('op1');
<span class='linenumber'> 804</span>    * ~~
<span class='linenumber'> 805</span>    * 
<span class='linenumber'> 806</span>    * @param {String}  val  Valor a ser atrubuído a propriedade "value".
<span class='linenumber'> 807</span>    * @return {jProton.Set}
<span class='linenumber'> 808</span>    */</span><span class="WHIT">
<span class='linenumber'> 809</span> 
<span class='linenumber'> 810</span>   </span><span class="COMM">/**
<span class='linenumber'> 811</span>    * Marca ou seleciona elementos do tipo "select options", "checkbox" ou 
<span class='linenumber'> 812</span>    * "radio button".
<span class='linenumber'> 813</span>    * 
<span class='linenumber'> 814</span>    * ~~
<span class='linenumber'> 815</span>    * // Seleciona as opções 'Multiple2' e 'Multiple3' do select de id 'multiple'   
<span class='linenumber'> 816</span>    * $('#multiple').val(['Multiple2', 'Multiple3']);
<span class='linenumber'> 817</span>    *    
<span class='linenumber'> 818</span>    * // Marca o checkbox de valor 'check2' e o radio button de valor 'radio1'
<span class='linenumber'> 819</span>    * $('input').val(['check2', 'radio1']);
<span class='linenumber'> 820</span>    * ~~
<span class='linenumber'> 821</span>    *
<span class='linenumber'> 822</span>    * @param {Array}   values   Array de Strings com os valores dos elementos
<span class='linenumber'> 823</span>    *                           que serão marcados ou selecionados.
<span class='linenumber'> 824</span>    *                        
<span class='linenumber'> 825</span>    * @return {jProton.Set}
<span class='linenumber'> 826</span>    */</span><span class="WHIT">
<span class='linenumber'> 827</span>   </span><span class="NAME">val</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 828</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 829</span>       </span><span class="COMM">// Processa $().val(val)</span><span class="WHIT">
<span class='linenumber'> 830</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 831</span>         </span><span class="NAME">element.val</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 832</span> 
<span class='linenumber'> 833</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 834</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 835</span>       </span><span class="COMM">// Processa $().val()</span><span class="WHIT">
<span class='linenumber'> 836</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element.val</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 837</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 838</span> 
<span class='linenumber'> 839</span>   </span><span class="COMM">/**
<span class='linenumber'> 840</span>    * Retorna o conteúdo HTML do primeiro elemento selecionado.
<span class='linenumber'> 841</span>    * 
<span class='linenumber'> 842</span>    * @return {String}
<span class='linenumber'> 843</span>    */</span><span class="WHIT">
<span class='linenumber'> 844</span> 
<span class='linenumber'> 845</span>   </span><span class="COMM">/**
<span class='linenumber'> 846</span>    * Aletar o conteúdo HTML de todos elementos selecionados.
<span class='linenumber'> 847</span>    * 
<span class='linenumber'> 848</span>    * @param {String}  val   Conteúdo HTML a ser atribuído.
<span class='linenumber'> 849</span>    * @return {jProton.Set}
<span class='linenumber'> 850</span>    */</span><span class="WHIT">
<span class='linenumber'> 851</span>   </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 852</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 853</span>       </span><span class="COMM">// Processa $().html(val)</span><span class="WHIT">
<span class='linenumber'> 854</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 855</span>         </span><span class="NAME">ei.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 856</span> 
<span class='linenumber'> 857</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 858</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 859</span>       </span><span class="COMM">// Processa $().html()</span><span class="WHIT">
<span class='linenumber'> 860</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">innerHTML</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 861</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 862</span> 
<span class='linenumber'> 863</span>   </span><span class="COMM">/**
<span class='linenumber'> 864</span>    * Adiciona o conteúdo HTML no final do interior de todos elementos 
<span class='linenumber'> 865</span>    * selecionados.
<span class='linenumber'> 866</span>    * 
<span class='linenumber'> 867</span>    * @param {String}  val   Conteúdo HTML a ser adicionado.
<span class='linenumber'> 868</span>    * @return {jProton.Set}
<span class='linenumber'> 869</span>    */</span><span class="WHIT">
<span class='linenumber'> 870</span>   </span><span class="NAME">append</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 871</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 872</span>       </span><span class="NAME">ei.innerHTML</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 873</span> 
<span class='linenumber'> 874</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 875</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 876</span> 
<span class='linenumber'> 877</span>   </span><span class="COMM">/**
<span class='linenumber'> 878</span>    * Adiciona o conteúdo HTML no início do interior de todos elementos 
<span class='linenumber'> 879</span>    * selecionados.
<span class='linenumber'> 880</span>    * 
<span class='linenumber'> 881</span>    * @param {String}  val   Conteúdo HTML a ser adicionado.
<span class='linenumber'> 882</span>    * @return {jProton.Set}
<span class='linenumber'> 883</span>    */</span><span class="WHIT">
<span class='linenumber'> 884</span>   </span><span class="NAME">prepend</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 885</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 886</span>       </span><span class="NAME">ei.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">ei.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 887</span> 
<span class='linenumber'> 888</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 889</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 890</span> 
<span class='linenumber'> 891</span>   </span><span class="COMM">/**
<span class='linenumber'> 892</span>    * Retorna o conteúdo de texto do primeiro elemento selecionado.
<span class='linenumber'> 893</span>    * 
<span class='linenumber'> 894</span>    * @return {String}
<span class='linenumber'> 895</span>    */</span><span class="WHIT">
<span class='linenumber'> 896</span> 
<span class='linenumber'> 897</span>   </span><span class="COMM">/**
<span class='linenumber'> 898</span>    * Altera o conteúdo de texto de todos os elementos selecionados.
<span class='linenumber'> 899</span>    *
<span class='linenumber'> 900</span>    * @param {String}  val  Conteúdo de texto a ser atribuído.
<span class='linenumber'> 901</span>    * @return {jProton.Set}
<span class='linenumber'> 902</span>    */</span><span class="WHIT">
<span class='linenumber'> 903</span>   </span><span class="NAME">text</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 904</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 905</span>       </span><span class="COMM">// Processa $().text(val)</span><span class="WHIT">
<span class='linenumber'> 906</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 907</span>         </span><span class="NAME">element.text</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 908</span> 
<span class='linenumber'> 909</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 910</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 911</span>       </span><span class="COMM">// Processa $().text()</span><span class="WHIT">
<span class='linenumber'> 912</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element.text</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 913</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'> 914</span> 
<span class='linenumber'> 915</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'> 916</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 917</span> 
<span class='linenumber'> 918</span> 
<span class='linenumber'> 919</span> </span><span class="COMM">// Extensão css para jProton.</span><span class="WHIT">
<span class='linenumber'> 920</span> </span><span class="COMM">/**#@+ @extends css */</span><span class="WHIT">
<span class='linenumber'> 921</span> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="NAME">element</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">/** @lends jProton.element */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 922</span> 
<span class='linenumber'> 923</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'css'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 924</span> 
<span class='linenumber'> 925</span>   </span><span class="COMM">/**
<span class='linenumber'> 926</span>    * Verifica se o elemento possui uma determinada classe.
<span class='linenumber'> 927</span>    * 
<span class='linenumber'> 928</span>    * @param {Element}  e      Elemento alvo.         
<span class='linenumber'> 929</span>    * @param {String}   name   Nome da classe.
<span class='linenumber'> 930</span>    */</span><span class="WHIT">
<span class='linenumber'> 931</span>   </span><span class="NAME">hasClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 932</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">e.className</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 933</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 934</span> 
<span class='linenumber'> 935</span>   </span><span class="COMM">/**
<span class='linenumber'> 936</span>    * Processa a lógica de addClass() para um único elemento.
<span class='linenumber'> 937</span>    *
<span class='linenumber'> 938</span>    * @param {Element}  e      Elemento alvo.         
<span class='linenumber'> 939</span>    * @param {String}   name   Nome da classe.
<span class='linenumber'> 940</span>    */</span><span class="WHIT">
<span class='linenumber'> 941</span>   </span><span class="NAME">addClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 942</span>     </span><span class="COMM">// cópia de performance de jProton.hasClass(e, name)</span><span class="WHIT">
<span class='linenumber'> 943</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">e.className</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 944</span>       </span><span class="NAME">e.className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.className</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">e.className</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'> 945</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 946</span> 
<span class='linenumber'> 947</span>   </span><span class="COMM">/**
<span class='linenumber'> 948</span>    * Processa a lógica de removeClass() para um único elemento.
<span class='linenumber'> 949</span>    * 
<span class='linenumber'> 950</span>    * @param {Element}  e      Elemento alvo.         
<span class='linenumber'> 951</span>    * @param {String}   name   Nome da classe.
<span class='linenumber'> 952</span>    */</span><span class="WHIT">
<span class='linenumber'> 953</span>   </span><span class="NAME">removeClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 954</span>     </span><span class="NAME">e.className</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">' '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">e.className</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="WHIT">
<span class='linenumber'> 955</span>         </span><span class="NAME">replace</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">RegExp</span><span class="PUNC">(</span><span class="STRN">'(\\S*)\\s+'</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">'\\s+(\\S*)'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'g'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'$1 $2'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="WHIT">
<span class='linenumber'> 956</span>         </span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/^\s*|\s*$/g</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 957</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 958</span> 
<span class='linenumber'> 959</span>   </span><span class="COMM">/**
<span class='linenumber'> 960</span>    * Alterna o uso de uma classe em todos os elementos selecionados.
<span class='linenumber'> 961</span>    *
<span class='linenumber'> 962</span>    * @param {Element} e      Elemento alvo.         
<span class='linenumber'> 963</span>    * @param {String}  name   Nome da classe.
<span class='linenumber'> 964</span>    */</span><span class="WHIT">
<span class='linenumber'> 965</span>   </span><span class="NAME">toggleClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 966</span>     </span><span class="COMM">// cópia de performance de jProton.hasClass(e, name)</span><span class="WHIT">
<span class='linenumber'> 967</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">e.className</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 968</span>       </span><span class="NAME">this.removeClass</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 969</span>     </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 970</span>       </span><span class="NAME">this.addClass</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 971</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'> 972</span> 
<span class='linenumber'> 973</span>   </span><span class="COMM">/**
<span class='linenumber'> 974</span>    * Retorna o valor da propriedade de estilo do elemento.
<span class='linenumber'> 975</span>    * Baseado em: [[http://www.quirksmode.org/dom/getstyles.html|quirksmode]].
<span class='linenumber'> 976</span>    * 
<span class='linenumber'> 977</span>    * @param {Element} e      Elemento alvo.         
<span class='linenumber'> 978</span>    * @param {String}  name   Nome da propriedade de estilo.
<span class='linenumber'> 979</span>    * @param {String}  val    Valor a ser atribuído.
<span class='linenumber'> 980</span>    */</span><span class="WHIT">
<span class='linenumber'> 981</span>   </span><span class="NAME">css</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 982</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 983</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> 
<span class='linenumber'> 984</span>         </span><span class="COMM">// processa css(name, val)</span><span class="WHIT">
<span class='linenumber'> 985</span>         </span><span class="NAME">e.style</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 986</span> 
<span class='linenumber'> 987</span>       </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'> 988</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'> 989</span> 
<span class='linenumber'> 990</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'object'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 991</span>           </span><span class="COMM">// processa css(e, {name1: val1, name2: val2})</span><span class="WHIT">
<span class='linenumber'> 992</span>           </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">p</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'> 993</span>             </span><span class="NAME">e.style</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">[</span><span class="NAME">p</span><span class="PUNC">]</span><span class="WHIT">
<span class='linenumber'> 994</span> 
<span class='linenumber'> 995</span>         </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'> 996</span>           </span><span class="COMM">// processa css(e, name)</span><span class="WHIT">
<span class='linenumber'> 997</span>           </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">window.getComputedStyle</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="COMM">// Tenta o modo Mozilla</span><span class="WHIT">
<span class='linenumber'> 998</span>               </span><span class="NAME">document.defaultView.getComputedStyle</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> 
<span class='linenumber'> 999</span>               </span><span class="NAME">e.style</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">          </span><span class="COMM">// Ou então, tenta a propriedade style</span><span class="WHIT">
<span class='linenumber'>1000</span>               </span><span class="NAME">e.currentStyle</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">         </span><span class="COMM">// Tenta o modo IE</span><span class="WHIT">
<span class='linenumber'>1001</span>               </span><span class="NAME">e.currentStyle</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">  </span><span class="COMM">// Se não der certo,</span><span class="WHIT">
<span class='linenumber'>1002</span>               </span><span class="NAME">e.style</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT">          </span><span class="COMM">// tenta a propriedade style. Senão,</span><span class="WHIT">
<span class='linenumber'>1003</span>               </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">               </span><span class="COMM">// Não foi possível recuperar o estilo</span><span class="WHIT">
<span class='linenumber'>1004</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1005</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1006</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1007</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1008</span> 
<span class='linenumber'>1009</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1010</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1011</span> 
<span class='linenumber'>1012</span> 
<span class='linenumber'>1013</span> </span><span class="COMM">// Extensão css para jProton.Set.</span><span class="WHIT">
<span class='linenumber'>1014</span> </span><span class="COMM">/**#@+ @extends css */</span><span class="WHIT">
<span class='linenumber'>1015</span> </span><span class="NAME">set.extend</span><span class="PUNC">(</span><span class="COMM">/** @lends jProton.Set.prototype */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1016</span> 
<span class='linenumber'>1017</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'css'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1018</span> 
<span class='linenumber'>1019</span>   </span><span class="COMM">/**
<span class='linenumber'>1020</span>    * Verifica se o primeiro elemento selecionado possui uma determinada classe.
<span class='linenumber'>1021</span>    *
<span class='linenumber'>1022</span>    * @param {String}  name   Nome da classe.
<span class='linenumber'>1023</span>    * @return {Boolean}
<span class='linenumber'>1024</span>    */</span><span class="WHIT">
<span class='linenumber'>1025</span>   </span><span class="NAME">hasClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1026</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> 
<span class='linenumber'>1027</span>       </span><span class="COMM">// cópia de performance de jProton.hasClass(e, name)</span><span class="WHIT">
<span class='linenumber'>1028</span>       </span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">className</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">name</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> 
<span class='linenumber'>1029</span>       </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1030</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1031</span> 
<span class='linenumber'>1032</span>   </span><span class="COMM">/**
<span class='linenumber'>1033</span>    * Adiciona a classe a todos elementos selecionados.
<span class='linenumber'>1034</span>    * 
<span class='linenumber'>1035</span>    * @param {String}  name   Nome da classe.
<span class='linenumber'>1036</span>    * @return {jProton.Set}
<span class='linenumber'>1037</span>    */</span><span class="WHIT">
<span class='linenumber'>1038</span>   </span><span class="NAME">addClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1039</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1040</span>       </span><span class="NAME">element.addClass</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1041</span> 
<span class='linenumber'>1042</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1043</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1044</span> 
<span class='linenumber'>1045</span>   </span><span class="COMM">/**
<span class='linenumber'>1046</span>    * Remove a classe de todos os elementos selecionados.
<span class='linenumber'>1047</span>    * 
<span class='linenumber'>1048</span>    * @param {String}  name   Nome da classe.
<span class='linenumber'>1049</span>    * @return {jProton.Set}
<span class='linenumber'>1050</span>    */</span><span class="WHIT">
<span class='linenumber'>1051</span>   </span><span class="NAME">removeClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1052</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1053</span>       </span><span class="NAME">element.removeClass</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1054</span> 
<span class='linenumber'>1055</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1056</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1057</span> 
<span class='linenumber'>1058</span>   </span><span class="COMM">/**
<span class='linenumber'>1059</span>    * Alterna o uso de uma classe em todos os elementos selecionados.
<span class='linenumber'>1060</span>    * 
<span class='linenumber'>1061</span>    * @param {String}  name   Nome da classe.
<span class='linenumber'>1062</span>    * @return {jProton.Set}
<span class='linenumber'>1063</span>    */</span><span class="WHIT">
<span class='linenumber'>1064</span>   </span><span class="NAME">toggleClass</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1065</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1066</span>       </span><span class="NAME">element.toggleClass</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1067</span> 
<span class='linenumber'>1068</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1069</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1070</span> 
<span class='linenumber'>1071</span>   </span><span class="COMM">/**
<span class='linenumber'>1072</span>    * Retorna o valor da propriedade de estilo do primeiro elemento selecionado.
<span class='linenumber'>1073</span>    * 
<span class='linenumber'>1074</span>    * @param {String}  name   Nome da propriedade de estilo.
<span class='linenumber'>1075</span>    * @return {Value}   
<span class='linenumber'>1076</span>    */</span><span class="WHIT">
<span class='linenumber'>1077</span> 
<span class='linenumber'>1078</span>   </span><span class="COMM">/**
<span class='linenumber'>1079</span>    * Altera os valores de um conjunto de propriedades de todos os elementos 
<span class='linenumber'>1080</span>    * selecionados.
<span class='linenumber'>1081</span>    * 
<span class='linenumber'>1082</span>    * @param {Object}  properties   Objeto contendo pares de propriedade/valor.
<span class='linenumber'>1083</span>    * @return {jProton.Set}
<span class='linenumber'>1084</span>    */</span><span class="WHIT">
<span class='linenumber'>1085</span> 
<span class='linenumber'>1086</span>   </span><span class="COMM">/**
<span class='linenumber'>1087</span>    * Altera o valor da propriedade de estilo de todos os elementos selecionados.
<span class='linenumber'>1088</span>    * Baseado em: [[http://www.quirksmode.org/dom/getstyles.html|Quirksmode]].
<span class='linenumber'>1089</span>    * 
<span class='linenumber'>1090</span>    * @param {String}  name   Nome da propriedade de estilo.
<span class='linenumber'>1091</span>    * @param {String}  val    Valor da propriedade.
<span class='linenumber'>1092</span>    * @return {jProton.Set}
<span class='linenumber'>1093</span>    */</span><span class="WHIT">
<span class='linenumber'>1094</span>   </span><span class="NAME">css</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1095</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1096</span>       </span><span class="COMM">// Processa $().css(name, val)</span><span class="WHIT">
<span class='linenumber'>1097</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1098</span>         </span><span class="NAME">element.css</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1099</span> 
<span class='linenumber'>1100</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1101</span>     </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1102</span>       </span><span class="COMM">// Processa $().css(name)</span><span class="WHIT">
<span class='linenumber'>1103</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">element.css</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1104</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1105</span> 
<span class='linenumber'>1106</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1107</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1108</span> 
<span class='linenumber'>1109</span> 
<span class='linenumber'>1110</span> </span><span class="COMM">/**
<span class='linenumber'>1111</span>  * Namespace responsável pela manipulação de eventos. Adaptado a partir de: 
<span class='linenumber'>1112</span>  * [[http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html|Quirksmode]].
<span class='linenumber'>1113</span>  *  
<span class='linenumber'>1114</span>  * @name jProton.event
<span class='linenumber'>1115</span>  * @namespace
<span class='linenumber'>1116</span>  */</span><span class="WHIT">
<span class='linenumber'>1117</span> </span><span class="COMM">/**#@+ @extends event */</span><span class="WHIT">
<span class='linenumber'>1118</span> </span><span class="NAME">jProton.event</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1119</span>   
<span class='linenumber'>1120</span>   </span><span class="COMM">/**
<span class='linenumber'>1121</span>    * Lista de eventos registrados
<span class='linenumber'>1122</span>    * @private
<span class='linenumber'>1123</span>    * @memberOf jProton.event
<span class='linenumber'>1124</span>    * @type Object[]
<span class='linenumber'>1125</span>    */</span><span class="WHIT">
<span class='linenumber'>1126</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_events</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1127</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">addEventListener</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.addEventListener</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1128</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">attachEvent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.attachEvent</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1129</span>   
<span class='linenumber'>1130</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="COMM">/** @lends jProton.event */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1131</span>     </span><span class="NAME">version</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'jProton.event.0.3.9a'</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1132</span>   
<span class='linenumber'>1133</span>     </span><span class="COMM">/**
<span class='linenumber'>1134</span>      * Adiciona o tratamento de um evento a um elemento.
<span class='linenumber'>1135</span>      * 
<span class='linenumber'>1136</span>      * @param {Element}  e     Elemento alvo.
<span class='linenumber'>1137</span>      * @param {String}   type  Tipo de evento a ser adicionado.
<span class='linenumber'>1138</span>      * @param {Function} fn    Função de tratamento do evento.   
<span class='linenumber'>1139</span>      */</span><span class="WHIT">
<span class='linenumber'>1140</span>     </span><span class="NAME">add</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1141</span>       </span><span class="NAME">_events.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">e</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1142</span>   
<span class='linenumber'>1143</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">addEventListener</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1144</span>         </span><span class="NAME">e.addEventListener</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1145</span> 
<span class='linenumber'>1146</span>       </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attachEvent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1147</span>         </span><span class="NAME">e</span><span class="PUNC">[</span><span class="STRN">'e'</span><span class="PUNC">+</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1148</span>         </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="STRN">'e'</span><span class="PUNC">+</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">window.event</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1149</span>         </span><span class="NAME">e.attachEvent</span><span class="PUNC">(</span><span class="STRN">'on'</span><span class="PUNC">+</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1150</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1151</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1152</span>   
<span class='linenumber'>1153</span>     </span><span class="COMM">/**
<span class='linenumber'>1154</span>      * Remove o tratamento de um evento de um elemento.
<span class='linenumber'>1155</span>      * 
<span class='linenumber'>1156</span>      * @param {Element}  e     Elemento alvo.
<span class='linenumber'>1157</span>      * @param {String}   type  Tipo de evento a ser removido.
<span class='linenumber'>1158</span>      * @param {Function} fn    Função de tratamento do evento.   
<span class='linenumber'>1159</span>      */</span><span class="WHIT">
<span class='linenumber'>1160</span>     </span><span class="NAME">remove</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1161</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fn.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1162</span> 
<span class='linenumber'>1163</span>       </span><span class="COMM">// Remove o evento da lista de eventos</span><span class="WHIT">
<span class='linenumber'>1164</span>       </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">li</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">li</span><span class="PUNC">=</span><span class="NAME">_events</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1165</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">li.e</span><span class="PUNC">==</span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">li.type</span><span class="PUNC">==</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">li.fn</span><span class="PUNC">==</span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">li.fn.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="NAME">fs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1166</span>           </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_events.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">,</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1167</span>           </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1168</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1169</span> 
<span class='linenumber'>1170</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">l</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1171</span>         </span><span class="COMM">// tenha certeza que esta apontado para a função original</span><span class="WHIT">
<span class='linenumber'>1172</span>         </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">l.fn</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1173</span>         </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">addEventListener</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1174</span>           </span><span class="NAME">e.removeEventListener</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1175</span> 
<span class='linenumber'>1176</span>         </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attachEvent</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1177</span>           </span><span class="NAME">e.detachEvent</span><span class="PUNC">(</span><span class="STRN">'on'</span><span class="PUNC">+</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1178</span>           </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1179</span>           </span><span class="NAME">e</span><span class="PUNC">[</span><span class="STRN">'e'</span><span class="PUNC">+</span><span class="NAME">type</span><span class="PUNC">+</span><span class="NAME">fn</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1180</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1181</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1182</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1183</span>   
<span class='linenumber'>1184</span>     </span><span class="COMM">/**
<span class='linenumber'>1185</span>      * Remove todos os eventos adicionados.
<span class='linenumber'>1186</span>      */</span><span class="WHIT">     
<span class='linenumber'>1187</span>     </span><span class="NAME">removeAll</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1188</span>       </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">li</span><span class="PUNC">=</span><span class="NAME">_events</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1189</span>         </span><span class="NAME">this.remove</span><span class="PUNC">(</span><span class="NAME">li.e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">li.type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">li.fn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1190</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1191</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1192</span> 
<span class='linenumber'>1193</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1194</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1195</span> 
<span class='linenumber'>1196</span> 
<span class='linenumber'>1197</span> </span><span class="COMM">// Extensão event para jProton.Set.</span><span class="WHIT">
<span class='linenumber'>1198</span> </span><span class="COMM">/**#@+ @extends event */</span><span class="WHIT">
<span class='linenumber'>1199</span> </span><span class="NAME">set.extend</span><span class="PUNC">(</span><span class="COMM">/** @lends jProton.Set.prototype */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1200</span> 
<span class='linenumber'>1201</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'event'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1202</span> 
<span class='linenumber'>1203</span>   </span><span class="COMM">/**
<span class='linenumber'>1204</span>    * Trata um determinado evento em todos os elementos selecionados.
<span class='linenumber'>1205</span>    * 
<span class='linenumber'>1206</span>    * @param {String}   type  Tipo de evento a ser tratado.
<span class='linenumber'>1207</span>    * @param {Function} fn    Função de tratamento do evento.
<span class='linenumber'>1208</span>    * @return {jProton.Set}
<span class='linenumber'>1209</span>    */</span><span class="WHIT">
<span class='linenumber'>1210</span>   </span><span class="NAME">on</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1211</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1212</span>       </span><span class="NAME">jProton.event.add</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1213</span>     </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1214</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1215</span> 
<span class='linenumber'>1216</span>   </span><span class="COMM">/**
<span class='linenumber'>1217</span>    * Cancela o tratamento um determinado evento em todos os elementos 
<span class='linenumber'>1218</span>    * selecionados.
<span class='linenumber'>1219</span>    *
<span class='linenumber'>1220</span>    * @param {String}   type  Tipo de evento a ser tratado.
<span class='linenumber'>1221</span>    * @param {Function} fn    Função de tratamento do evento.
<span class='linenumber'>1222</span>    * @return {jProton.Set}
<span class='linenumber'>1223</span>    */</span><span class="WHIT">
<span class='linenumber'>1224</span>   </span><span class="NAME">un</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1225</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1226</span>       </span><span class="NAME">jProton.event.remove</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1227</span>     </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1228</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1229</span> 
<span class='linenumber'>1230</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1231</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1232</span> 
<span class='linenumber'>1233</span> 
<span class='linenumber'>1234</span> </span><span class="COMM">/**
<span class='linenumber'>1235</span>  * Namespace responsável pelo controle de recursos AJAX.
<span class='linenumber'>1236</span>  * 
<span class='linenumber'>1237</span>  * @namespace
<span class='linenumber'>1238</span>  */</span><span class="WHIT">
<span class='linenumber'>1239</span> </span><span class="NAME">jProton.ajax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1240</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.ajax.request</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1241</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1242</span> 
<span class='linenumber'>1243</span> </span><span class="COMM">// Atalho para jProton.ajax</span><span class="WHIT">
<span class='linenumber'>1244</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ajax</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.ajax</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1245</span> 
<span class='linenumber'>1246</span> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="NAME">ajax</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1247</span> 
<span class='linenumber'>1248</span>   </span><span class="COMM">/**#@+
<span class='linenumber'>1249</span>    * @memberOf jProton.ajax  
<span class='linenumber'>1250</span>    * @extends ajax   
<span class='linenumber'>1251</span>    */</span><span class="WHIT">
<span class='linenumber'>1252</span> 
<span class='linenumber'>1253</span>   </span><span class="COMM">/** 
<span class='linenumber'>1254</span>    * Lista de requisições pendentes
<span class='linenumber'>1255</span>    * @name _requests
<span class='linenumber'>1256</span>    * @type request[]
<span class='linenumber'>1257</span>    */</span><span class="WHIT">
<span class='linenumber'>1258</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_requests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1259</span> 
<span class='linenumber'>1260</span>   </span><span class="COMM">/** 
<span class='linenumber'>1261</span>    * Objeto "XMLHttpRequest" usado nas requisições.
<span class='linenumber'>1262</span>    * @name _transport
<span class='linenumber'>1263</span>    * @type XMLHttpRequest
<span class='linenumber'>1264</span>    */</span><span class="WHIT">
<span class='linenumber'>1265</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_transport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1266</span> 
<span class='linenumber'>1267</span>   </span><span class="COMM">/** 
<span class='linenumber'>1268</span>    * Função de callback usada para carregar JSON remotamente.
<span class='linenumber'>1269</span>    * @name _callback
<span class='linenumber'>1270</span>    * @type Function
<span class='linenumber'>1271</span>    */</span><span class="WHIT">
<span class='linenumber'>1272</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1273</span> 
<span class='linenumber'>1274</span>   </span><span class="COMM">/** 
<span class='linenumber'>1275</span>    * Estados da requisição.
<span class='linenumber'>1276</span>    * @name _states
<span class='linenumber'>1277</span>    * @type String[]
<span class='linenumber'>1278</span>    */</span><span class="WHIT">
<span class='linenumber'>1279</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_states</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'Uninitialized'</span><span class="PUNC">,</span><span class="STRN">'Loading'</span><span class="PUNC">,</span><span class="STRN">'Loaded'</span><span class="PUNC">,</span><span class="STRN">'Interactive'</span><span class="PUNC">,</span><span class="STRN">'Complete'</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1280</span> 
<span class='linenumber'>1281</span>   </span><span class="COMM">/**#@+ @function */</span><span class="WHIT">
<span class='linenumber'>1282</span> 
<span class='linenumber'>1283</span>   </span><span class="COMM">/**
<span class='linenumber'>1284</span>    * Envia a próxima requisição da fila.
<span class='linenumber'>1285</span>    */</span><span class="WHIT">  
<span class='linenumber'>1286</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_sendRequest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1287</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_transport</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_requests.shift</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1288</span> 
<span class='linenumber'>1289</span>     </span><span class="COMM">// Abre o objeto XMLHttpRequest</span><span class="WHIT">
<span class='linenumber'>1290</span>     </span><span class="NAME">t.open</span><span class="PUNC">(</span><span class="NAME">r.type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r.url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r.async</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1291</span> 
<span class='linenumber'>1292</span>     </span><span class="COMM">//setRequestHeaders();</span><span class="WHIT">
<span class='linenumber'>1293</span> 
<span class='linenumber'>1294</span>     </span><span class="COMM">// Registra o objeto para que o servidor saiba que é uma requisição AJAX</span><span class="WHIT">
<span class='linenumber'>1295</span>     </span><span class="NAME">t.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">'X-Requested-With'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'XMLHttpRequest'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1296</span> 
<span class='linenumber'>1297</span>     </span><span class="COMM">// Caso tenha sido informado algum dado</span><span class="WHIT">
<span class='linenumber'>1298</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.serialize</span><span class="PUNC">(</span><span class="NAME">r.data</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1299</span>       </span><span class="NAME">t.setRequestHeader</span><span class="PUNC">(</span><span class="STRN">'Content-Type'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r.contentType</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1300</span> 
<span class='linenumber'>1301</span>     </span><span class="COMM">/** @ignore */</span><span class="WHIT">
<span class='linenumber'>1302</span>     </span><span class="COMM">// Tratamento de evento de mudança de estado</span><span class="WHIT">
<span class='linenumber'>1303</span>     </span><span class="NAME">t.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> 
<span class='linenumber'>1304</span>         </span><span class="NAME">_onStateChange</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1305</span>       </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1306</span> 
<span class='linenumber'>1307</span>     </span><span class="COMM">// Envia a requisição</span><span class="WHIT">
<span class='linenumber'>1308</span>     </span><span class="NAME">t.send</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1309</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1310</span> 
<span class='linenumber'>1311</span>   </span><span class="COMM">/**
<span class='linenumber'>1312</span>    * Função de tratamento da mudança de estado da requisição ajax.
<span class='linenumber'>1313</span>    */</span><span class="WHIT">     
<span class='linenumber'>1314</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_onStateChange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1315</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_transport</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1316</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_getState</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1317</span> 
<span class='linenumber'>1318</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">[</span><span class="STRN">'on'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">state</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">(</span><span class="NAME">_getResponse</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1319</span> 
<span class='linenumber'>1320</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'Complete'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1321</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">success</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">t.status</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_getResponse</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1322</span> 
<span class='linenumber'>1323</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">[</span><span class="STRN">'onUpdate'</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1324</span>         </span><span class="NAME">fn</span><span class="PUNC">(</span><span class="NAME">response</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1325</span> 
<span class='linenumber'>1326</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">[</span><span class="STRN">'on'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">success</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'Success'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'Failure'</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1327</span>         </span><span class="NAME">fn</span><span class="PUNC">(</span><span class="NAME">response</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1328</span> 
<span class='linenumber'>1329</span>       </span><span class="NAME">t.onreadystatechange</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.emptyFn</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1330</span> 
<span class='linenumber'>1331</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">_requests.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> 
<span class='linenumber'>1332</span>         </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="NAME">_sendRequest</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">10</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1333</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1334</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1335</span> 
<span class='linenumber'>1336</span>   </span><span class="COMM">/**
<span class='linenumber'>1337</span>    * Retorna a resposta de acordo com o tipo de dado requisitado.
<span class='linenumber'>1338</span>    */</span><span class="WHIT">  
<span class='linenumber'>1339</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_getResponse</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1340</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">t</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_transport</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.dataType</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1341</span> 
<span class='linenumber'>1342</span>     </span><span class="KEYW">if</span><span class="WHIT">      </span><span class="PUNC">(</span><span class="NAME">t.status</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">200</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t.statusText</span><span class="WHIT">
<span class='linenumber'>1343</span>     </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'text'</span><span class="PUNC">)</span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t.responseText</span><span class="WHIT">
<span class='linenumber'>1344</span>     </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'html'</span><span class="PUNC">)</span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t.responseText</span><span class="WHIT">
<span class='linenumber'>1345</span>     </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'xml'</span><span class="PUNC">)</span><span class="WHIT">   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t.responseXML</span><span class="WHIT">
<span class='linenumber'>1346</span>     </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'json'</span><span class="PUNC">)</span><span class="WHIT">  </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="STRN">'('</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">t.responseText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">')'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1347</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1348</span> 
<span class='linenumber'>1349</span>   </span><span class="COMM">/**
<span class='linenumber'>1350</span>    * Retorna o atual estado da requisição ajax.
<span class='linenumber'>1351</span>    */</span><span class="WHIT">     
<span class='linenumber'>1352</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_getState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1353</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_states</span><span class="PUNC">[</span><span class="NAME">_transport.readyState</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1354</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1355</span> 
<span class='linenumber'>1356</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1357</span>   </span><span class="COMM">/**#@+ @extends ajax */</span><span class="WHIT">
<span class='linenumber'>1358</span> 
<span class='linenumber'>1359</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="COMM">/** @lends jProton.ajax */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1360</span>   
<span class='linenumber'>1361</span>     </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'ajax'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1362</span>   
<span class='linenumber'>1363</span>     </span><span class="COMM">/**
<span class='linenumber'>1364</span>      * Inicializa o módulo ajax, criando o objeto "XMLHttpRequest".
<span class='linenumber'>1365</span>      * @ignore
<span class='linenumber'>1366</span>      */</span><span class="WHIT">
<span class='linenumber'>1367</span>     </span><span class="STRN">'@init'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1368</span>       </span><span class="NAME">_transport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1369</span>   
<span class='linenumber'>1370</span>       </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1371</span>         </span><span class="NAME">_transport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">XMLHttpRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1372</span>       </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1373</span>         </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1374</span>           </span><span class="NAME">_transport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Msxml2.XMLHTTP"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1375</span>         </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1376</span>           </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1377</span>             </span><span class="NAME">_transport</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ActiveXObject</span><span class="PUNC">(</span><span class="STRN">"Microsoft.XMLHTTP"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1378</span>           </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1379</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1380</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1381</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1382</span>     
<span class='linenumber'>1383</span>     </span><span class="COMM">/**
<span class='linenumber'>1384</span>      * Realiza uma requisição ajax.
<span class='linenumber'>1385</span>      * 
<span class='linenumber'>1386</span>      * @param {Object}   options               Opções da requisição.  
<span class='linenumber'>1387</span>      * @param {String}   options.url           URL a ser requisitada.
<span class='linenumber'>1388</span>      * @param {String}   options.type          Tipo de requisição ("get" ou "post"). O padrão é "get".
<span class='linenumber'>1389</span>      * @param {Boolean}  options.async         Indica se a requisição é assíncrona. O padrão é "true".   
<span class='linenumber'>1390</span>      * @param {String}   options.dataType      Dado requisitado ("text", "html", "xml" ou "json"). O padrão é "text".
<span class='linenumber'>1391</span>      * @param {String}   options.contentType   ContentType a ser usado. O padrão é "application/x-www-form-urlencoded".  
<span class='linenumber'>1392</span>      * @param {Function} options.onLoading     Função a ser executada antes da requisição ser enviada.
<span class='linenumber'>1393</span>      * @param {Function} options.onLoaded      Função a ser executada logo que a requisição for enviada.
<span class='linenumber'>1394</span>      * @param {Function} options.onInteractive Função a ser executada durante o recebimento da requisição.
<span class='linenumber'>1395</span>      * @param {Function} options.onComplete    Função a ser executada ao completar a requisição.
<span class='linenumber'>1396</span>      * @param {Function} options.onUpdate      Função a ser executada após completar a requisição.
<span class='linenumber'>1397</span>      * @param {Function} options.onSuccess     Função a ser executada ao completar a requisição com sucesso.
<span class='linenumber'>1398</span>      * @param {Function} options.onError       Função a ser executada ao completar a requisição com erro.
<span class='linenumber'>1399</span>      */</span><span class="WHIT">      
<span class='linenumber'>1400</span>     </span><span class="NAME">request</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1401</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">o</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1402</span>   
<span class='linenumber'>1403</span>       </span><span class="COMM">// Configura as opções que não foram definidas para o seu valor padrão</span><span class="WHIT">
<span class='linenumber'>1404</span>       </span><span class="NAME">o.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.type</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">o.type.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'get'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1405</span>       </span><span class="NAME">o.async</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.async</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1406</span>       </span><span class="NAME">o.dataType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.dataType</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'text'</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1407</span>       </span><span class="NAME">o.contentType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">o.contentType</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'application/x-www-form-urlencoded'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1408</span>   
<span class='linenumber'>1409</span>       </span><span class="NAME">_requests.push</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1410</span>   
<span class='linenumber'>1411</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_getState</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1412</span>       </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'Uninitialized'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'Complete'</span><span class="PUNC">)</span><span class="WHIT"> 
<span class='linenumber'>1413</span>         </span><span class="NAME">_sendRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1414</span>     </span><span class="PUNC">}</span><span class="WHIT">  
<span class='linenumber'>1415</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1416</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1417</span> </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1418</span> 
<span class='linenumber'>1419</span> 
<span class='linenumber'>1420</span> </span><span class="COMM">// Extensão ajax para jProton.Set. Requer extensão dom de jProton.Set.</span><span class="WHIT">
<span class='linenumber'>1421</span> </span><span class="NAME">set.extend</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT"> 
<span class='linenumber'>1422</span> 
<span class='linenumber'>1423</span>   </span><span class="STRN">'@require'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'dom'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1424</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'ajax'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.3.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1425</span> 
<span class='linenumber'>1426</span>   </span><span class="COMM">/**#@+
<span class='linenumber'>1427</span>    * @function
<span class='linenumber'>1428</span>    * @memberOf jProton.Set
<span class='linenumber'>1429</span>    * @extends ajax
<span class='linenumber'>1430</span>    */</span><span class="WHIT">
<span class='linenumber'>1431</span> 
<span class='linenumber'>1432</span>   </span><span class="COMM">/**
<span class='linenumber'>1433</span>    * Realiza requisição ajax e carrega o conteúdo nos elementos selecionados.
<span class='linenumber'>1434</span>    *    
<span class='linenumber'>1435</span>    * @param {String}   url       URL a ser requisitada.
<span class='linenumber'>1436</span>    * @param {Data}     data      Dados a serem enviados.
<span class='linenumber'>1437</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1438</span>    * @name load
<span class='linenumber'>1439</span>    */</span><span class="WHIT">
<span class='linenumber'>1440</span>   </span><span class="NAME">load</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1441</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1442</span> 
<span class='linenumber'>1443</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1444</span>       </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1445</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1446</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1447</span> 
<span class='linenumber'>1448</span>     </span><span class="NAME">ajax.request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1449</span>       </span><span class="NAME">elements</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>1450</span>       </span><span class="NAME">onUpdate</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">,</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1451</span>         </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">o.elements</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1452</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1453</span>     </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1454</span> 
<span class='linenumber'>1455</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1456</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1457</span> 
<span class='linenumber'>1458</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1459</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1460</span> 
<span class='linenumber'>1461</span> 
<span class='linenumber'>1462</span> </span><span class="COMM">// Extensão ajax para jProton.</span><span class="WHIT">
<span class='linenumber'>1463</span> </span><span class="NAME">jProton.extend</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1464</span> 
<span class='linenumber'>1465</span>   </span><span class="STRN">'@extension'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'ajax'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'0.2.0a'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1466</span> 
<span class='linenumber'>1467</span>   </span><span class="COMM">/**#@+
<span class='linenumber'>1468</span>    * @function
<span class='linenumber'>1469</span>    * @memberOf jProton
<span class='linenumber'>1470</span>    * @extends ajax
<span class='linenumber'>1471</span>    */</span><span class="WHIT">
<span class='linenumber'>1472</span> 
<span class='linenumber'>1473</span>   </span><span class="COMM">/**
<span class='linenumber'>1474</span>    * Serializa.
<span class='linenumber'>1475</span>    * 
<span class='linenumber'>1476</span>    * @name serialize
<span class='linenumber'>1477</span>    * @param {Object} data Desc
<span class='linenumber'>1478</span>    */</span><span class="WHIT">
<span class='linenumber'>1479</span>   </span><span class="NAME">serialize</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1480</span>   	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">''</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1481</span>   	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1482</span>   		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT">	</span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT">
<span class='linenumber'>1483</span>   			
<span class='linenumber'>1484</span>   		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">data.innerHTML</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">data.elements</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1485</span>   			</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">el</span><span class="PUNC">,</span><span class="NAME">l</span><span class="PUNC">=</span><span class="PUNC">(</span><span class="NAME">el</span><span class="PUNC">=</span><span class="NAME">data.elements</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1486</span>   				</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1487</span>   				  </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1488</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'='</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1489</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">el</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1490</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1491</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1492</span>   					
<span class='linenumber'>1493</span>   		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> 
<span class='linenumber'>1494</span>   			</span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">param</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1495</span> 				  </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">param</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='linenumber'>1496</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'='</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1497</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">[</span><span class="NAME">param</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1498</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="NAME">rl</span><span class="PUNC">++</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'&'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1499</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1500</span>   	</span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1501</span>   	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r.join</span><span class="PUNC">(</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/&$/</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1502</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1503</span> 
<span class='linenumber'>1504</span>   </span><span class="COMM">/**
<span class='linenumber'>1505</span>    * Realiza uma requisição ajax do tipo "get", retornando texto.
<span class='linenumber'>1506</span>    *    
<span class='linenumber'>1507</span>    * @name get
<span class='linenumber'>1508</span>    * @param {String}   url       URL a ser requisitada.
<span class='linenumber'>1509</span>    * @param {Data}     data      Dados a serem enviados.
<span class='linenumber'>1510</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1511</span>    */</span><span class="WHIT">
<span class='linenumber'>1512</span>   </span><span class="NAME">get</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1513</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1514</span> 
<span class='linenumber'>1515</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1516</span>       </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1517</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1518</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1519</span> 
<span class='linenumber'>1520</span>     </span><span class="NAME">ajax.request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1521</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1522</span> 
<span class='linenumber'>1523</span>   </span><span class="COMM">/**
<span class='linenumber'>1524</span>    * Realiza uma requisição ajax do tipo "get", retornando JSON.
<span class='linenumber'>1525</span>    *
<span class='linenumber'>1526</span>    * @name getJSON
<span class='linenumber'>1527</span>    * @param {String}   url       URL a ser requisitada.
<span class='linenumber'>1528</span>    * @param {Data}     data      Dados a serem enviados.
<span class='linenumber'>1529</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1530</span>    */</span><span class="WHIT">
<span class='linenumber'>1531</span>   </span><span class="NAME">getJSON</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1532</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1533</span> 
<span class='linenumber'>1534</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1535</span>       </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1536</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1537</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1538</span> 
<span class='linenumber'>1539</span>     </span><span class="NAME">ajax.request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'json'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1540</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1541</span> 
<span class='linenumber'>1542</span>   </span><span class="COMM">/**
<span class='linenumber'>1543</span>    * Realiza uma requisição ajax do tipo "get", retornando XML.
<span class='linenumber'>1544</span>    *
<span class='linenumber'>1545</span>    * @name getXML
<span class='linenumber'>1546</span>    * @param {String}   url       URL a ser requisitada.
<span class='linenumber'>1547</span>    * @param {Data}     data      Dados a serem enviados.
<span class='linenumber'>1548</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1549</span>    */</span><span class="WHIT">
<span class='linenumber'>1550</span>   </span><span class="NAME">getXML</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1551</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1552</span> 
<span class='linenumber'>1553</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1554</span>       </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1555</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1556</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1557</span> 
<span class='linenumber'>1558</span>     </span><span class="NAME">ajax.request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">dataType</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'xml'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1559</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1560</span> 
<span class='linenumber'>1561</span>   </span><span class="COMM">/**
<span class='linenumber'>1562</span>    * Realiza uma requisição ajax do tipo "post".
<span class='linenumber'>1563</span>    *
<span class='linenumber'>1564</span>    * @name post
<span class='linenumber'>1565</span>    * @param {String}   url       URL a ser requisitada.
<span class='linenumber'>1566</span>    * @param {Data}     data      Dados a serem enviados.
<span class='linenumber'>1567</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1568</span>    */</span><span class="WHIT">
<span class='linenumber'>1569</span>   </span><span class="NAME">post</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1570</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1571</span> 
<span class='linenumber'>1572</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1573</span>       </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1574</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1575</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1576</span> 
<span class='linenumber'>1577</span>     </span><span class="NAME">ajax.request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'post'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onSuccess</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1578</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1579</span> 
<span class='linenumber'>1580</span>   </span><span class="COMM">/**
<span class='linenumber'>1581</span>    * Carrega um script dinamicamente.
<span class='linenumber'>1582</span>    *    
<span class='linenumber'>1583</span>    * @name loadScript
<span class='linenumber'>1584</span>    * @param {String}   url       URL do script.
<span class='linenumber'>1585</span>    */</span><span class="WHIT">
<span class='linenumber'>1586</span>   </span><span class="NAME">loadScript</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1587</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">script</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="STRN">'dynamicScript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1588</span> 
<span class='linenumber'>1589</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1590</span>       </span><span class="NAME">script.parentNode.removeChild</span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1591</span> 
<span class='linenumber'>1592</span>     </span><span class="NAME">script</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">'script'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1593</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'src'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1594</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'dynamicScript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1595</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'text/javascript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1596</span>     </span><span class="NAME">document.documentElement.firstChild.appendChild</span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1597</span>   </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1598</span> 
<span class='linenumber'>1599</span>   </span><span class="COMM">/**
<span class='linenumber'>1600</span>    * Carrega JSON remotamente (JSONP).
<span class='linenumber'>1601</span>    *    
<span class='linenumber'>1602</span>    * @name loadJSONP
<span class='linenumber'>1603</span>    * @param {String}   url       URL dos dados.
<span class='linenumber'>1604</span>    * @param {String}   jsonp     Nome da função de retorno do servidor. O 
<span class='linenumber'>1605</span>    *                             padrão é "callback".
<span class='linenumber'>1606</span>    * @param {Function} callback  Função de retorno.
<span class='linenumber'>1607</span>    */</span><span class="WHIT">
<span class='linenumber'>1608</span>   </span><span class="NAME">loadJSONP</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">jsonp</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1609</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jsonp</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'callback'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">jProton.emptyFn</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1610</span>         </span><span class="NAME">script</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="STRN">'dynamicScript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1611</span> 
<span class='linenumber'>1612</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">jsonp</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1613</span>       </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'callback'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1614</span>       </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jsonp</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1615</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1616</span> 
<span class='linenumber'>1617</span>     </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1618</span>       </span><span class="NAME">script.parentNode.removeChild</span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1619</span> 
<span class='linenumber'>1620</span>     </span><span class="NAME">ajax._callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1621</span>     </span><span class="NAME">script</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.createElement</span><span class="PUNC">(</span><span class="STRN">'script'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1622</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'src'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'&'</span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'=jProton.ajax._callback'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1623</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'dynamicScript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1624</span>     </span><span class="NAME">script.setAttribute</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'text/javascript'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1625</span>     </span><span class="NAME">document.documentElement.firstChild.appendChild</span><span class="PUNC">(</span><span class="NAME">script</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1626</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1627</span> 
<span class='linenumber'>1628</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1629</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1630</span> 
<span class='linenumber'>1631</span> 
<span class='linenumber'>1632</span> </span><span class="COMM">/**
<span class='linenumber'>1633</span>  * Namespace responsável pela seleção de elementos através de seletores CSS. 
<span class='linenumber'>1634</span>  * Baseado em 
<span class='linenumber'>1635</span>  * [[http://extjs.com/deploy/ext/docs/output/Ext.DomQuery.html|DomQuery]].
<span class='linenumber'>1636</span>  * 
<span class='linenumber'>1637</span>  * @name jProton.query
<span class='linenumber'>1638</span>  * @namespace
<span class='linenumber'>1639</span>  */</span><span class="WHIT">
<span class='linenumber'>1640</span> </span><span class="COMM">/** @ignore */</span><span class="WHIT">
<span class='linenumber'>1641</span> </span><span class="NAME">jProton.query</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1642</span>   </span><span class="COMM">/**#@+ 
<span class='linenumber'>1643</span>    * @private 
<span class='linenumber'>1644</span>    * @function
<span class='linenumber'>1645</span>    * @memberOf jProton.query
<span class='linenumber'>1646</span>    * @extends core
<span class='linenumber'>1647</span>    */</span><span class="WHIT">
<span class='linenumber'>1648</span> 
<span class='linenumber'>1649</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cache</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>1650</span>     </span><span class="NAME">simpleCache</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>1651</span>     </span><span class="NAME">reTrim</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/^\s+|\s+$/g</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1652</span>     </span><span class="NAME">reTemplate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/\{(\d+)\}/g</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1653</span>     </span><span class="NAME">reMode</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/^(\s?[\/>+~]\s?|\s|$)/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1654</span>     </span><span class="NAME">reTag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/^(#)?([\w-\*]+)/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1655</span>     </span><span class="NAME">reNth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/(\d*)n\+?(\d*)/</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>1656</span>     </span><span class="NAME">reNth2</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="REGX">/\D/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1657</span> 
<span class='linenumber'>1658</span>     </span><span class="COMM">// This is for IE MSXML which does not support expandos.</span><span class="WHIT">
<span class='linenumber'>1659</span>     </span><span class="COMM">// IE runs the same speed using setAttribute, however FF slows way down</span><span class="WHIT">
<span class='linenumber'>1660</span>     </span><span class="COMM">// and Safari completely fails so they need to continue to use expandos.</span><span class="WHIT">
<span class='linenumber'>1661</span>     </span><span class="NAME">isIE</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">!</span><span class="NAME">window.ActiveXObject</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1662</span>     </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">30803</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1663</span> 
<span class='linenumber'>1664</span>   </span><span class="COMM">// this eval is stop the compressor from</span><span class="WHIT">
<span class='linenumber'>1665</span>   </span><span class="COMM">// renaming the variable to something shorter</span><span class="WHIT">
<span class='linenumber'>1666</span>   </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="STRN">"var batch = 30803;"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1667</span> 
<span class='linenumber'>1668</span>   </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_quickId</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">mode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1669</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1670</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">context.ownerDocument</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1671</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">d.getElementById</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1672</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1673</span>     </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_getNodes</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">mode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"*"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1674</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_byId</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1675</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1676</span> 
<span class='linenumber'>1677</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_byId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1678</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e.tagName</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1679</span>       </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">e</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1680</span> 
<span class='linenumber'>1681</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1682</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1683</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ei.id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1684</span>         </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1685</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1686</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1687</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1688</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1689</span> 
<span class='linenumber'>1690</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_byTag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1691</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">e.tagName</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1692</span>       </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">e</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1693</span> 
<span class='linenumber'>1694</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1695</span>     </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1696</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1697</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ei.tagName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1698</span>         </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1699</span> 
<span class='linenumber'>1700</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1701</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1702</span> 
<span class='linenumber'>1703</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_byClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1704</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1705</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1706</span> 
<span class='linenumber'>1707</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1708</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1709</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">ei.className</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1710</span>         </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1711</span> 
<span class='linenumber'>1712</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1713</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1714</span> 
<span class='linenumber'>1715</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_byAttr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">op</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1716</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.operators</span><span class="PUNC">[</span><span class="NAME">op</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1717</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1718</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"class"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"className"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1719</span>         </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.className</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1720</span>       </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"for"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1721</span>         </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.htmlFor</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1722</span>       </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"href"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1723</span>         </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.getAttribute</span><span class="PUNC">(</span><span class="STRN">"href"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1724</span>       </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1725</span>         </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.getAttribute</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1726</span> 
<span class='linenumber'>1727</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1728</span>         </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1729</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1730</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1731</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1732</span> 
<span class='linenumber'>1733</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_byPseudo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1734</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">query.pseudos</span><span class="PUNC">[</span><span class="NAME">name</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1735</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1736</span> 
<span class='linenumber'>1737</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_getNodes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">mode</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1738</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1739</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1740</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1741</span> 
<span class='linenumber'>1742</span>     </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"*"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1743</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">e.getElementsByTagName</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1744</span>       </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">e</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1745</span> 
<span class='linenumber'>1746</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">mode</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1747</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1748</span>         </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.getElementsByTagName</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1749</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1750</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1751</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1752</span>     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mode</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"/"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">mode</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">">"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1753</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">utag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name.toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1754</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1755</span>         </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.children</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">ei.childNodes</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1756</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1757</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nj.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">utag</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nj.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT">  </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'*'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1758</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1759</span> 
<span class='linenumber'>1760</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1761</span>     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mode</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"+"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1762</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">utag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name.toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1763</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1764</span>         </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.nextSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ei.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1765</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ei.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">utag</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">ei.nodeName</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'*'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1766</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1767</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1768</span>     </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mode</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"~"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1769</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1770</span>         </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.nextSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ei.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> 
<span class='linenumber'>1771</span>               </span><span class="PUNC">(</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'*'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">ei.tagName.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">!=</span><span class="NAME">name</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1772</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1773</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1774</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1775</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1776</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1777</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1778</span> 
<span class='linenumber'>1779</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_unique</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1780</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1781</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1782</span> 
<span class='linenumber'>1783</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.length</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1784</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">e.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1785</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1786</span> 
<span class='linenumber'>1787</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isIE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">selectSingleNode</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1788</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1789</span>       </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">setAttribute</span><span class="PUNC">(</span><span class="STRN">"__unique"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1790</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1791</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1792</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">ei.getAttribute</span><span class="PUNC">(</span><span class="STRN">"__unique"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1793</span>           </span><span class="NAME">ei.setAttribute</span><span class="PUNC">(</span><span class="STRN">"__unique"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1794</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1795</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1796</span>   
<span class='linenumber'>1797</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1798</span>         </span><span class="NAME">ei.removeAttribute</span><span class="PUNC">(</span><span class="STRN">"__unique"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1799</span>   
<span class='linenumber'>1800</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1801</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1802</span> 
<span class='linenumber'>1803</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1804</span>     </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">__unique</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1805</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1806</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.__unique</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1807</span>         </span><span class="NAME">ei.__unique</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1808</span>       </span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1809</span>         </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1810</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1811</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1812</span> 
<span class='linenumber'>1813</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ej</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1814</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ej.__unique</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1815</span>             </span><span class="NAME">ej.__unique</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1816</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ej</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1817</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1818</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1819</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1820</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1821</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1822</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1823</span> 
<span class='linenumber'>1824</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_diff</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e2</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1825</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">e.length</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1826</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e2</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1827</span> 
<span class='linenumber'>1828</span>     </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">isIE</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">selectSingleNode</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1829</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1830</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1831</span>         </span><span class="NAME">ei.setAttribute</span><span class="PUNC">(</span><span class="STRN">"__diff"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1832</span>   
<span class='linenumber'>1833</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1834</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e2</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1835</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.getAttribute</span><span class="PUNC">(</span><span class="STRN">"__diff"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1836</span>           </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1837</span>   
<span class='linenumber'>1838</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1839</span>         </span><span class="NAME">ei.removeAttribute</span><span class="PUNC">(</span><span class="STRN">"__diff"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1840</span>   
<span class='linenumber'>1841</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1842</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1843</span> 
<span class='linenumber'>1844</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">d</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">key</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1845</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1846</span>       </span><span class="NAME">ei.__diff</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1847</span> 
<span class='linenumber'>1848</span>     </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1849</span>     </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e2</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1850</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.__diff</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1851</span>         </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1852</span> 
<span class='linenumber'>1853</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1854</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1855</span> 
<span class='linenumber'>1856</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_next</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1857</span>     </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.nextSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">e.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1858</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1859</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1860</span> 
<span class='linenumber'>1861</span>   </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_prev</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1862</span>     </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e.previousSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">e.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1863</span>     </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1864</span>   </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1865</span> 
<span class='linenumber'>1866</span>   </span><span class="COMM">/**#@-*/</span><span class="WHIT">
<span class='linenumber'>1867</span>   </span><span class="COMM">/**#@+ @extends core */</span><span class="WHIT">
<span class='linenumber'>1868</span>   </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="COMM">/** @lends jProton.query */</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1869</span>     </span><span class="COMM">/**
<span class='linenumber'>1870</span>      * Compiles a selector/xpath query into a reusable function. The returned function
<span class='linenumber'>1871</span>      * takes one parameter "context" (optional), which is the context node from where the query should start.
<span class='linenumber'>1872</span>      * @param {String} selector The selector/xpath query
<span class='linenumber'>1873</span>      * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match
<span class='linenumber'>1874</span>      * @return {Function}
<span class='linenumber'>1875</span>      */</span><span class="WHIT">
<span class='linenumber'>1876</span>     </span><span class="NAME">compile</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1877</span>       </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"select"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1878</span> 
<span class='linenumber'>1879</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ls</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1880</span>         </span><span class="NAME">rules</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.rules</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1881</span>         </span><span class="NAME">mm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rm</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">matched</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='linenumber'>1882</span>         </span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">"var fn=function(c){\nvar mode; var e=c||document; ++batch;\n"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1883</span> 
<span class='linenumber'>1884</span>       </span><span class="COMM">// accept leading mode switch</span><span class="WHIT">
<span class='linenumber'>1885</span>       </span><span class="NAME">mm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.match</span><span class="PUNC">(</span><span class="NAME">reMode</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1886</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mm</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1887</span>         </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'mode="'</span><span class="PUNC">+</span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="NAME">reTrim</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'";'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1888</span>         </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1889</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1890</span> 
<span class='linenumber'>1891</span>       </span><span class="COMM">// strip leading slashes</span><span class="WHIT">
<span class='linenumber'>1892</span>       </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">s.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"/"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1893</span>         </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.substr</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1894</span> 
<span class='linenumber'>1895</span>       </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ls</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1896</span>         </span><span class="NAME">ls</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1897</span>         </span><span class="NAME">tm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.match</span><span class="PUNC">(</span><span class="NAME">reTag</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1898</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"select"</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1899</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1900</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1901</span>               </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'e = _quickId(e, mode, c, "'</span><span class="PUNC">+</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">'");'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1902</span>             </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1903</span>               </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'e = _getNodes(e, mode, "'</span><span class="PUNC">+</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">'");'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1904</span> 
<span class='linenumber'>1905</span>             </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1906</span>           </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">s.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'@'</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1907</span>             </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'e = _getNodes(e, mode, "*");'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1908</span> 
<span class='linenumber'>1909</span>         </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1910</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1911</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1912</span>               </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'e = _byId(e, "'</span><span class="PUNC">+</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">'");'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1913</span>             </span><span class="KEYW">else</span><span class="WHIT">
<span class='linenumber'>1914</span>               </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'e = _byTag(e, "'</span><span class="PUNC">+</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="PUNC">+</span><span class="STRN">'");'</span><span class="WHIT">
<span class='linenumber'>1915</span> 
<span class='linenumber'>1916</span>             </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="NAME">tm</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1917</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1918</span> 
<span class='linenumber'>1919</span>         </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">mm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.match</span><span class="PUNC">(</span><span class="NAME">reMode</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1920</span>           </span><span class="NAME">matched</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1921</span>           </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">rm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">rules</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1922</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">m</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.match</span><span class="PUNC">(</span><span class="NAME">rm.re</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1923</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1924</span>               </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="PUNC">=</span><span class="NAME">rm.select.replace</span><span class="PUNC">(</span><span class="NAME">reTemplate</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1925</span>               </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1926</span>               </span><span class="NAME">matched</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1927</span>               </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1928</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1929</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1930</span>           </span><span class="COMM">// prevent infinite loop on bad selector</span><span class="WHIT">
<span class='linenumber'>1931</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">matched</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1932</span>             </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="STRN">'Error parsing selector, parsing failed at "'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'"'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1933</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1934</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1935</span>           </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'mode="'</span><span class="PUNC">+</span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="NAME">reTrim</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'";'</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1936</span>           </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">s.replace</span><span class="PUNC">(</span><span class="NAME">mm</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1937</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1938</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1939</span>       </span><span class="NAME">f</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">fl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"return _unique(e);\n}"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1940</span>       </span><span class="NAME">eval</span><span class="PUNC">(</span><span class="NAME">f.join</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1941</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1942</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1943</span> 
<span class='linenumber'>1944</span>     </span><span class="COMM">/**
<span class='linenumber'>1945</span>      * Selects a group of elements.
<span class='linenumber'>1946</span>      * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)
<span class='linenumber'>1947</span>      * @param {Node} context (optional) The start of the query (defaults to document).
<span class='linenumber'>1948</span>      * @return {Array}
<span class='linenumber'>1949</span>      */</span><span class="WHIT">
<span class='linenumber'>1950</span>     </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">selector</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1951</span>       </span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1952</span> 
<span class='linenumber'>1953</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1954</span>         </span><span class="NAME">context</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1955</span> 
<span class='linenumber'>1956</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">selectors</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">selector.split</span><span class="PUNC">(</span><span class="STRN">","</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">selectors.length</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1957</span>       </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1958</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">selectors</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="NAME">reTrim</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1959</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">cache</span><span class="PUNC">[</span><span class="NAME">s</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1960</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">cache</span><span class="PUNC">[</span><span class="NAME">s</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.compile</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1961</span>             </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" is not a valid selector"</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1962</span> 
<span class='linenumber'>1963</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">cache</span><span class="PUNC">[</span><span class="NAME">s</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">context</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1964</span>         </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">document</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1965</span>           </span><span class="NAME">results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">results.concat</span><span class="PUNC">(</span><span class="NAME">result</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1966</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>1967</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1968</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_unique</span><span class="PUNC">(</span><span class="NAME">results</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1969</span> 
<span class='linenumber'>1970</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">results</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1971</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1972</span> 
<span class='linenumber'>1973</span>     </span><span class="COMM">/**
<span class='linenumber'>1974</span>      * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)
<span class='linenumber'>1975</span>      * @param {String/HTMLElement/Array} e An element id, elvalent or array of elements
<span class='linenumber'>1976</span>      * @param {String} selector The simple selector to test
<span class='linenumber'>1977</span>      * @return {Boolean}
<span class='linenumber'>1978</span>      */</span><span class="WHIT">
<span class='linenumber'>1979</span>     </span><span class="NAME">is</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ss</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1980</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1981</span>         </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">document.getElementById</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1982</span> 
<span class='linenumber'>1983</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isArray</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">!</span><span class="NAME">e.splice</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1984</span>           </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.filter</span><span class="PUNC">(</span><span class="NAME">isArray</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">e</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">e</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ss</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1985</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isArray</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">e.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">result.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1986</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>1987</span> 
<span class='linenumber'>1988</span>     </span><span class="COMM">/**
<span class='linenumber'>1989</span>      * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)
<span class='linenumber'>1990</span>      * @param {Array} e An array of elements to filter
<span class='linenumber'>1991</span>      * @param {String} selector The simple selector to test
<span class='linenumber'>1992</span>      * @param {Boolean} nonMatches If true, it returns the elements that DON'T match
<span class='linenumber'>1993</span>      * the selector instead of the ones that match
<span class='linenumber'>1994</span>      * @return {Array}
<span class='linenumber'>1995</span>      */</span><span class="WHIT">
<span class='linenumber'>1996</span>     </span><span class="NAME">filter</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ss</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nonMatches</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>1997</span>       </span><span class="NAME">ss</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ss.replace</span><span class="PUNC">(</span><span class="NAME">reTrim</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>1998</span>       </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">simpleCache</span><span class="PUNC">[</span><span class="NAME">ss</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>1999</span>         </span><span class="NAME">simpleCache</span><span class="PUNC">[</span><span class="NAME">ss</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.compile</span><span class="PUNC">(</span><span class="NAME">ss</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"simple"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2000</span> 
<span class='linenumber'>2001</span>       </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">simpleCache</span><span class="PUNC">[</span><span class="NAME">ss</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2002</span>       </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">nonMatches</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">_diff</span><span class="PUNC">(</span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2003</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2004</span> 
<span class='linenumber'>2005</span>     </span><span class="COMM">/**
<span class='linenumber'>2006</span>      * Collection of matching regular expressions and code snippets.
<span class='linenumber'>2007</span>      */</span><span class="WHIT">
<span class='linenumber'>2008</span>     </span><span class="NAME">rules</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2009</span>         </span><span class="NAME">re</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/^\.([\w-]+)/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2010</span>         </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'e = _byClass(e, " {1} ");'</span><span class="WHIT">
<span class='linenumber'>2011</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2012</span>         </span><span class="NAME">re</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2013</span>         </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'e = _byPseudo(e, "{1}", "{2}");'</span><span class="WHIT">
<span class='linenumber'>2014</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2015</span>         </span><span class="NAME">re</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/^\[([\w-]+)(?:(.?=)["']?(.+?)["']?)?\]/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2016</span>         </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'e = _byAttr(e, "{1}", "{2}", "{3}");'</span><span class="WHIT">
<span class='linenumber'>2017</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2018</span>         </span><span class="NAME">re</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/^#([\w-]+)/</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2019</span>         </span><span class="NAME">select</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'e = _byId(e, "{1}");'</span><span class="WHIT">
<span class='linenumber'>2020</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2021</span>     </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2022</span> 
<span class='linenumber'>2023</span>     </span><span class="COMM">/**
<span class='linenumber'>2024</span>      * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.
<span class='linenumber'>2025</span>      * New operators can be added as long as the match the format &lt;i>c&lt;/i>= where &lt;i>c&lt;/i> is any character other than space, &gt; &lt;.
<span class='linenumber'>2026</span>      */</span><span class="WHIT">
<span class='linenumber'>2027</span>     </span><span class="NAME">operators</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2028</span>       </span><span class="STRN">"="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2029</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2030</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2031</span>       </span><span class="STRN">"!="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2032</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2033</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2034</span>       </span><span class="STRN">"^="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2035</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">attr.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2036</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2037</span>       </span><span class="STRN">"$="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2038</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">attr.substr</span><span class="PUNC">(</span><span class="NAME">attr.length</span><span class="PUNC">-</span><span class="NAME">val.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2039</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2040</span>       </span><span class="STRN">"*="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2041</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">attr.indexOf</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2042</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2043</span>       </span><span class="STRN">"%="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2044</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2045</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2046</span>       </span><span class="STRN">"|="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2047</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">attr.substr</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val.length</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">+</span><span class="STRN">'-'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2048</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2049</span>       </span><span class="STRN">"~="</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">attr</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2050</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">attr</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">attr</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="STRN">' '</span><span class="PUNC">+</span><span class="NAME">val</span><span class="PUNC">+</span><span class="STRN">' '</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2051</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2052</span>     </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2053</span> 
<span class='linenumber'>2054</span>     </span><span class="COMM">/**
<span class='linenumber'>2055</span>      * Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)
<span class='linenumber'>2056</span>      * and the argument (if any) supplied in the selector.
<span class='linenumber'>2057</span>      */</span><span class="WHIT">
<span class='linenumber'>2058</span>     </span><span class="NAME">pseudos</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2059</span>       </span><span class="STRN">"first-child"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2060</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2061</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2062</span>           </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n.previousSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">n.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2063</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2064</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2065</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2066</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2067</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2068</span> 
<span class='linenumber'>2069</span>       </span><span class="STRN">"last-child"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2070</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2071</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2072</span>           </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n.nextSibling</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">n.nodeType</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2073</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2074</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2075</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2076</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2077</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2078</span> 
<span class='linenumber'>2079</span>       </span><span class="STRN">"nth-child"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2080</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">m</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">reNth.exec</span><span class="PUNC">(</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"even"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="STRN">"2n"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> 
<span class='linenumber'>2081</span>           </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"odd"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="STRN">"2n+1"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">reNth2.test</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="STRN">"n+"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2082</span>           </span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">m</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">m</span><span class="PUNC">[</span><span class="NUMB">2</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2083</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2084</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">p</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.parentNode</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2085</span>           </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">batch</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">p._batch</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2086</span>             </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2087</span>             </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">p.firstChild</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n.nextSibling</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2088</span>               </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">n.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2089</span>                  </span><span class="NAME">n.nodeIndex</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="NAME">j</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2090</span> 
<span class='linenumber'>2091</span>             </span><span class="NAME">p._batch</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">batch</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2092</span>           </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2093</span>           </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2094</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">l</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">ei.nodeIndex</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2095</span>               </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2096</span> 
<span class='linenumber'>2097</span>           </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">ei.nodeIndex</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">l</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2098</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2099</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2100</span> 
<span class='linenumber'>2101</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2102</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2103</span> 
<span class='linenumber'>2104</span>       </span><span class="STRN">"only-child"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2105</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2106</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2107</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">_prev</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">_next</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2108</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2109</span> 
<span class='linenumber'>2110</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2111</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2112</span> 
<span class='linenumber'>2113</span>       </span><span class="STRN">"empty"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2114</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2115</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2116</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei.childNodes</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">empty</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2117</span>           </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">nj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2118</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">nj.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">nj.nodeType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">3</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2119</span>               </span><span class="NAME">empty</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2120</span>               </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2121</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2122</span> 
<span class='linenumber'>2123</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">empty</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2124</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2125</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2126</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2127</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2128</span> 
<span class='linenumber'>2129</span>       </span><span class="STRN">"contains"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2130</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2131</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2132</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">ei.textContent</span><span class="PUNC">||</span><span class="NAME">ei.innerText</span><span class="PUNC">||</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">indexOf</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2133</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2134</span> 
<span class='linenumber'>2135</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2136</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2137</span> 
<span class='linenumber'>2138</span>       </span><span class="STRN">"nodeValue"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2139</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2140</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2141</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.firstChild</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">ei.firstChild.nodeValue</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2142</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2143</span> 
<span class='linenumber'>2144</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2145</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2146</span> 
<span class='linenumber'>2147</span>       </span><span class="STRN">"checked"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2148</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2149</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2150</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ei.checked</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2151</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2152</span> 
<span class='linenumber'>2153</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2154</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2155</span> 
<span class='linenumber'>2156</span>       </span><span class="STRN">"not"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2157</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">query.filter</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2158</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2159</span> 
<span class='linenumber'>2160</span>       </span><span class="STRN">"any"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2161</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ss</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val.split</span><span class="PUNC">(</span><span class="STRN">'|'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2162</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2163</span>           </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ss</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2164</span>             </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">query.is</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2165</span>               </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2166</span>               </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2167</span>             </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2168</span> 
<span class='linenumber'>2169</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2170</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2171</span> 
<span class='linenumber'>2172</span>       </span><span class="STRN">"odd"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2173</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="STRN">"nth-child"</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"odd"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2174</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2175</span> 
<span class='linenumber'>2176</span>       </span><span class="STRN">"even"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2177</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">[</span><span class="STRN">"nth-child"</span><span class="PUNC">]</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"even"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2178</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2179</span> 
<span class='linenumber'>2180</span>       </span><span class="STRN">"nth"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2181</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">val</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2182</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2183</span> 
<span class='linenumber'>2184</span>       </span><span class="STRN">"first"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2185</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2186</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2187</span> 
<span class='linenumber'>2188</span>       </span><span class="STRN">"last"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2189</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">e.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2190</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2191</span> 
<span class='linenumber'>2192</span>       </span><span class="STRN">"has"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2193</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.select</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2194</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2195</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">s</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2196</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2197</span> 
<span class='linenumber'>2198</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2199</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2200</span> 
<span class='linenumber'>2201</span>       </span><span class="STRN">"next"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2202</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">is</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.is</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2203</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2204</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_next</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2205</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">is</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2206</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2207</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2208</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2209</span>       </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='linenumber'>2210</span> 
<span class='linenumber'>2211</span>       </span><span class="STRN">"prev"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2212</span>         </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">rl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">is</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">query.is</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2213</span>         </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='linenumber'>2214</span>           </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_prev</span><span class="PUNC">(</span><span class="NAME">ei</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2215</span>           </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">is</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT">
<span class='linenumber'>2216</span>             </span><span class="NAME">r</span><span class="PUNC">[</span><span class="PUNC">++</span><span class="NAME">rl</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ei</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2217</span>         </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2218</span>         </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2219</span>       </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2220</span>     </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2221</span>   </span><span class="PUNC">}</span><span class="WHIT">
<span class='linenumber'>2222</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2223</span> 
<span class='linenumber'>2224</span> </span><span class="COMM">// Atalho para jProton.query</span><span class="WHIT">
<span class='linenumber'>2225</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">query</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jProton.query</span><span class="PUNC">;</span><span class="WHIT">
<span class='linenumber'>2226</span> 
<span class='linenumber'>2227</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>